只有管理员权限用户能新增项目

This commit is contained in:
liwh9 2021-06-02 17:19:48 +08:00
parent e2cbbc218c
commit 82ba75cf36
30 changed files with 38 additions and 38 deletions

View File

@ -111,7 +111,7 @@ def execute_plan_by_manual(plan_id):
if 'planId' in request_data:
plan_id = request_data["planId"]
if not validate_plan_id(plan_id):
return jsonify({'status': 'failed', 'data': 'plan_id is invalid'}), 400
return jsonify({'status': 'failed', 'data': 'plan_id无效 或 当前plan未设置测试范围'}), 400
(env_name, protocol, domain) = get_env_name_and_domain(test_env_id)
if not protocol or not domain or not env_name:
@ -164,7 +164,7 @@ def execute_plan_by_web_hook(plan_id):
if 'planId' in request_data:
plan_id = request_data["planId"]
if not validate_plan_id(plan_id):
return jsonify({'status': 'failed', 'data': 'plan_id is invalid'}), 400
return jsonify({'status': 'failed', 'data': 'plan_id无效 或 当前plan未设置测试范围'}), 400
if "secretToken" not in request_data or not request_data['secretToken']:
return jsonify({'status': 'failed', 'data': '请提供secretToken'}), 400
if not check_secret_for_plan(plan_id, request_data["secretToken"]):

View File

@ -42,7 +42,7 @@ def get_project(project_id):
@app.route('/api/project/addProject', methods=['POST'])
@login_required
@roles_accepted('admin', 'project')
@roles_accepted('admin')
def add_project():
try:
params = request.get_json()

2
dist/index.html vendored
View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Leo API Auto Test</title><link href=/static/css/app.0542ad6c64fecfa3c0d3d903af69f82c.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.6cf761b4265e9d86b2aa.js></script><script type=text/javascript src=/static/js/vendor.ce1c2b43bcac79f509d7.js></script><script type=text/javascript src=/static/js/app.1d866b87fb663a00ac3f.js></script></body></html>
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>Leo API Auto Test</title><link href=/static/css/app.9663962b00047d46137a502972679831.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.eecfc327899ac121102e.js></script><script type=text/javascript src=/static/js/vendor.ce1c2b43bcac79f509d7.js></script><script type=text/javascript src=/static/js/app.7be1a4844736bbc549f9.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
webpackJsonp([26],{GYip:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n("GgDs"),r=n("EMlb"),o={name:"Project",components:{Header:a.a},data:function(){return{project_id:this.$route.params.project_id,projectName:"",projectNavMenu:this.$store.getters.routes}},methods:{handleSelect:function(e,t){}},mounted:function(){var e=this;Object(r.b)(this.$route.params.project_id).then(function(t){"ok"===t.status&&(e.projectName=t.data.name)})}},i={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-row",{staticClass:"container"},[n("header-view",{attrs:{projectName:e.projectName}}),e._v(" "),n("el-col",{attrs:{span:24}},[[n("el-menu",{staticClass:"el-menu-demo",attrs:{"default-active":"autoTest",mode:"horizontal","unique-opened":""},on:{select:e.handleSelect}},[e._l(e.projectNavMenu,function(t){return t.projectMenu?[e._l(t.children,function(t,a){return t.hidden?e._e():[t.leaf?n("el-menu-item",{key:t.path,class:e.$route.nav===t.nav?"is-active":"",attrs:{index:t.child?t.children[0].nav:t.nav}},[t.child?e._e():[n("router-link",{staticStyle:{"text-decoration":"none",color:"#000000"},attrs:{to:{name:t.name,params:{id:e.project_id}}}},[n("div",[e._v("\n "+e._s(t.meta.title)+"\n ")])])],e._v(" "),t.child?[n("router-link",{staticStyle:{"text-decoration":"none",color:"#000000"},attrs:{to:{name:t.children[0].name,params:{id:e.project_id}}}},[n("div",[e._v("\n "+e._s(t.meta.title)+"\n ")])])]:e._e()],2):e._e(),e._v(" "),t.leaf?e._e():n("el-submenu",{attrs:{index:a+""}},[n("template",{slot:"title"},[e._v(e._s(t.meta.title))]),e._v(" "),e._l(t.children,function(t){return t.hidden?e._e():n("el-menu-item",{key:t.path,attrs:{index:t.path}},[n("router-link",{staticStyle:{"text-decoration":"none",color:"#000000"},attrs:{to:{name:t.name,params:{id:e.project_id}}}},[e._v("\n "+e._s(t.meta.title)+"\n ")])],1)})],2)]})]:e._e()})],2)]],2),e._v(" "),n("el-col",{attrs:{span:24}},[n("transition",{attrs:{name:"fade",mode:"out-in"}},[n("router-view")],1)],1)],1)},staticRenderFns:[]};var c=n("VU/8")(o,i,!1,function(e){n("jh4M")},"data-v-362e8320",null);t.default=c.exports},jh4M:function(e,t){}});
//# sourceMappingURL=26.972fad83fc2df6474363.js.map
webpackJsonp([25],{GYip:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=n("GgDs"),r=n("EMlb"),o={name:"Project",components:{Header:a.a},data:function(){return{project_id:this.$route.params.project_id,projectName:"",projectNavMenu:this.$store.getters.routes}},methods:{handleSelect:function(e,t){}},mounted:function(){var e=this;Object(r.b)(this.$route.params.project_id).then(function(t){"ok"===t.status&&(e.projectName=t.data.name)})}},i={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-row",{staticClass:"container"},[n("header-view",{attrs:{projectName:e.projectName}}),e._v(" "),n("el-col",{attrs:{span:24}},[[n("el-menu",{staticClass:"el-menu-demo",attrs:{"default-active":"autoTest",mode:"horizontal","unique-opened":""},on:{select:e.handleSelect}},[e._l(e.projectNavMenu,function(t){return t.projectMenu?[e._l(t.children,function(t,a){return t.hidden?e._e():[t.leaf?n("el-menu-item",{key:t.path,class:e.$route.nav===t.nav?"is-active":"",attrs:{index:t.child?t.children[0].nav:t.nav}},[t.child?e._e():[n("router-link",{staticStyle:{"text-decoration":"none",color:"#000000"},attrs:{to:{name:t.name,params:{id:e.project_id}}}},[n("div",[e._v("\n "+e._s(t.meta.title)+"\n ")])])],e._v(" "),t.child?[n("router-link",{staticStyle:{"text-decoration":"none",color:"#000000"},attrs:{to:{name:t.children[0].name,params:{id:e.project_id}}}},[n("div",[e._v("\n "+e._s(t.meta.title)+"\n ")])])]:e._e()],2):e._e(),e._v(" "),t.leaf?e._e():n("el-submenu",{attrs:{index:a+""}},[n("template",{slot:"title"},[e._v(e._s(t.meta.title))]),e._v(" "),e._l(t.children,function(t){return t.hidden?e._e():n("el-menu-item",{key:t.path,attrs:{index:t.path}},[n("router-link",{staticStyle:{"text-decoration":"none",color:"#000000"},attrs:{to:{name:t.name,params:{id:e.project_id}}}},[e._v("\n "+e._s(t.meta.title)+"\n ")])],1)})],2)]})]:e._e()})],2)]],2),e._v(" "),n("el-col",{attrs:{span:24}},[n("transition",{attrs:{name:"fade",mode:"out-in"}},[n("router-view")],1)],1)],1)},staticRenderFns:[]};var c=n("VU/8")(o,i,!1,function(e){n("jh4M")},"data-v-362e8320",null);t.default=c.exports},jh4M:function(e,t){}});
//# sourceMappingURL=25.312571121cd35e567c48.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
webpackJsonp([29],{"/yg6":function(e,t){},lO7g:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={name:"Home",components:{Header:a("GgDs").a},data:function(){return{collapsed:!1}},methods:{collapse:function(e){this.collapsed=e}},created:function(){}},s={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-row",{staticClass:"container"},[a("header-view",{on:{collapse:e.collapse}}),e._v(" "),a("el-col",{staticClass:"main",attrs:{span:24}},[a("aside",{class:e.collapsed?"menu-collapsed":"menu-expanded"},[e.collapsed?e._e():a("el-menu",{staticClass:"el-menu-vertical-demo",attrs:{"default-active":e.$route.meta.menu,"unique-opened":"",router:""}},[e._l(e.$store.getters.routes,function(t,n){return t.hidden?e._e():e._l(t.children,function(t){return t.hidden?e._e():a("el-menu-item",{key:t.path,staticStyle:{"font-size":"16px"},attrs:{index:t.path}},[a("i",{class:t.meta.icon}),e._v(e._s(t.meta.title)+"\n ")])})})],2)],1),e._v(" "),a("section",{staticClass:"content-container"},[a("div",{staticClass:"grid-content bg-purple-light"},[a("el-col",{staticClass:"breadcrumb-container",attrs:{span:24}},[a("el-breadcrumb",{staticClass:"breadcrumb-inner",attrs:{separator:"/"}},e._l(e.$route.matched,function(t){return a("el-breadcrumb-item",{key:t.path,staticStyle:{"font-size":"15px"}},[e._v("\n "+e._s(t.name)+"\n ")])}),1)],1),e._v(" "),a("el-col",{staticClass:"content-wrapper",attrs:{span:24}},[a("transition",{attrs:{name:"fade",mode:"out-in"}},[a("router-view")],1)],1)],1)])])],1)},staticRenderFns:[]};var r=a("VU/8")(n,s,!1,function(e){a("/yg6")},"data-v-204f3e9e",null);t.default=r.exports}});
//# sourceMappingURL=29.aa0fdfccc538441071ed.js.map
webpackJsonp([28],{"/yg6":function(e,t){},lO7g:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={name:"Home",components:{Header:a("GgDs").a},data:function(){return{collapsed:!1}},methods:{collapse:function(e){this.collapsed=e}},created:function(){}},s={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("el-row",{staticClass:"container"},[a("header-view",{on:{collapse:e.collapse}}),e._v(" "),a("el-col",{staticClass:"main",attrs:{span:24}},[a("aside",{class:e.collapsed?"menu-collapsed":"menu-expanded"},[e.collapsed?e._e():a("el-menu",{staticClass:"el-menu-vertical-demo",attrs:{"default-active":e.$route.meta.menu,"unique-opened":"",router:""}},[e._l(e.$store.getters.routes,function(t,n){return t.hidden?e._e():e._l(t.children,function(t){return t.hidden?e._e():a("el-menu-item",{key:t.path,staticStyle:{"font-size":"16px"},attrs:{index:t.path}},[a("i",{class:t.meta.icon}),e._v(e._s(t.meta.title)+"\n ")])})})],2)],1),e._v(" "),a("section",{staticClass:"content-container"},[a("div",{staticClass:"grid-content bg-purple-light"},[a("el-col",{staticClass:"breadcrumb-container",attrs:{span:24}},[a("el-breadcrumb",{staticClass:"breadcrumb-inner",attrs:{separator:"/"}},e._l(e.$route.matched,function(t){return a("el-breadcrumb-item",{key:t.path,staticStyle:{"font-size":"15px"}},[e._v("\n "+e._s(t.name)+"\n ")])}),1)],1),e._v(" "),a("el-col",{staticClass:"content-wrapper",attrs:{span:24}},[a("transition",{attrs:{name:"fade",mode:"out-in"}},[a("router-view")],1)],1)],1)])])],1)},staticRenderFns:[]};var r=a("VU/8")(n,s,!1,function(e){a("/yg6")},"data-v-204f3e9e",null);t.default=r.exports}});
//# sourceMappingURL=28.085f9523b9ed94469bf3.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
!function(e){var c=window.webpackJsonp;window.webpackJsonp=function(a,r,t){for(var o,d,b,i=0,u=[];i<a.length;i++)d=a[i],f[d]&&u.push(f[d][0]),f[d]=0;for(o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);for(c&&c(a,r,t);u.length;)u.shift()();if(t)for(i=0;i<t.length;i++)b=n(n.s=t[i]);return b};var a={},f={40:0};function n(c){if(a[c])return a[c].exports;var f=a[c]={i:c,l:!1,exports:{}};return e[c].call(f.exports,f,f.exports,n),f.l=!0,f.exports}n.e=function(e){var c=f[e];if(0===c)return new Promise(function(e){e()});if(c)return c[2];var a=new Promise(function(a,n){c=f[e]=[a,n]});c[2]=a;var r=document.getElementsByTagName("head")[0],t=document.createElement("script");t.type="text/javascript",t.charset="utf-8",t.async=!0,t.timeout=12e4,n.nc&&t.setAttribute("nonce",n.nc),t.src=n.p+"static/js/"+e+"."+{0:"476a8d2fc1452efd35d9",1:"771bda981b2ef2f2725f",2:"485fe33c1f866ebd2541",3:"987ab19be987f5c97785",4:"2449a4b5f0a0cb433721",5:"1a66504c891068b5e80b",6:"47e9d0038a0b19c8bca1",7:"0ff48479f19f25ce7674",8:"733c74159da4c488e50a",9:"c75a395f17c9f3bfcb4e",10:"14346d9998a400ab89a6",11:"d5f0e09d528c57866613",12:"af326801ef9d0ab679ad",13:"8c72a47f3cb653a7256c",14:"a4328a4cc96acfdfde08",15:"4d6141bb01506c172330",16:"f30a48dfd3f773d4bb12",17:"1f460e38b624162aed9e",18:"567c3e9084a15c7b0248",19:"666527075369fc46c467",20:"3d7732d0b9e388aa24e1",21:"ecf8e76fcb5fd632ea78",22:"b13826942b7bb923fc47",23:"868cd36a7716992e1b18",24:"4643e46e7d23eb2c70cf",25:"7e110587007e9d26e266",26:"972fad83fc2df6474363",27:"cf38ca27185aa95cec05",28:"01db7cb25a236ce84c06",29:"aa0fdfccc538441071ed",30:"81fce2d78e1bc9e9f964",31:"09acfee525106e912f29",32:"91883f446231665dbceb",33:"ab98f29d3706ea7a23fa",34:"8d92068eb889089eac13",35:"620575e5fb0dfbe35a80",36:"82b724f8e2aee922add2",37:"8d06f4e04101e8a02a42"}[e]+".js";var o=setTimeout(d,12e4);function d(){t.onerror=t.onload=null,clearTimeout(o);var c=f[e];0!==c&&(c&&c[1](new Error("Loading chunk "+e+" failed.")),f[e]=void 0)}return t.onerror=t.onload=d,r.appendChild(t),a},n.m=e,n.c=a,n.d=function(e,c,a){n.o(e,c)||Object.defineProperty(e,c,{configurable:!1,enumerable:!0,get:a})},n.n=function(e){var c=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(c,"a",c),c},n.o=function(e,c){return Object.prototype.hasOwnProperty.call(e,c)},n.p="/",n.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.6cf761b4265e9d86b2aa.js.map

View File

@ -0,0 +1,2 @@
!function(e){var a=window.webpackJsonp;window.webpackJsonp=function(c,r,t){for(var o,d,b,i=0,u=[];i<c.length;i++)d=c[i],f[d]&&u.push(f[d][0]),f[d]=0;for(o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);for(a&&a(c,r,t);u.length;)u.shift()();if(t)for(i=0;i<t.length;i++)b=n(n.s=t[i]);return b};var c={},f={40:0};function n(a){if(c[a])return c[a].exports;var f=c[a]={i:a,l:!1,exports:{}};return e[a].call(f.exports,f,f.exports,n),f.l=!0,f.exports}n.e=function(e){var a=f[e];if(0===a)return new Promise(function(e){e()});if(a)return a[2];var c=new Promise(function(c,n){a=f[e]=[c,n]});a[2]=c;var r=document.getElementsByTagName("head")[0],t=document.createElement("script");t.type="text/javascript",t.charset="utf-8",t.async=!0,t.timeout=12e4,n.nc&&t.setAttribute("nonce",n.nc),t.src=n.p+"static/js/"+e+"."+{0:"476a8d2fc1452efd35d9",1:"771bda981b2ef2f2725f",2:"cb96fb67b7ee4d62ebef",3:"987ab19be987f5c97785",4:"2449a4b5f0a0cb433721",5:"1a66504c891068b5e80b",6:"47e9d0038a0b19c8bca1",7:"0ff48479f19f25ce7674",8:"733c74159da4c488e50a",9:"c75a395f17c9f3bfcb4e",10:"14346d9998a400ab89a6",11:"d5f0e09d528c57866613",12:"af326801ef9d0ab679ad",13:"8c72a47f3cb653a7256c",14:"a4328a4cc96acfdfde08",15:"4d6141bb01506c172330",16:"f30a48dfd3f773d4bb12",17:"1f460e38b624162aed9e",18:"567c3e9084a15c7b0248",19:"666527075369fc46c467",20:"3d7732d0b9e388aa24e1",21:"ecf8e76fcb5fd632ea78",22:"b13826942b7bb923fc47",23:"868cd36a7716992e1b18",24:"4643e46e7d23eb2c70cf",25:"312571121cd35e567c48",26:"2eb809349907cea05be3",27:"28bcfdda59106d858743",28:"085f9523b9ed94469bf3",29:"6a89e46ab030a2d98d47",30:"4d13f6a8632e5e244673",31:"eb3ed82cd337fc8eaa19",32:"91883f446231665dbceb",33:"ab98f29d3706ea7a23fa",34:"8d92068eb889089eac13",35:"620575e5fb0dfbe35a80",36:"82b724f8e2aee922add2",37:"8d06f4e04101e8a02a42"}[e]+".js";var o=setTimeout(d,12e4);function d(){t.onerror=t.onload=null,clearTimeout(o);var a=f[e];0!==a&&(a&&a[1](new Error("Loading chunk "+e+" failed.")),f[e]=void 0)}return t.onerror=t.onload=d,r.appendChild(t),c},n.m=e,n.c=c,n.d=function(e,a,c){n.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:c})},n.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(a,"a",a),a},n.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},n.p="/",n.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.eecfc327899ac121102e.js.map

View File

@ -9,7 +9,7 @@
<el-form-item>
<el-button type="primary" class="el-icon-search" @click="getProjectList">查询</el-button>
</el-form-item>
<el-form-item>
<el-form-item v-if="$store.getters.roles.includes('admin')">
<el-button type="primary" class="el-icon-plus" @click="handleAdd">新增项目</el-button>
</el-form-item>
</el-form>