@nocobase/plugin-acl 2.1.0-alpha.21 → 2.1.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client-v2/{627.ce101823deb86dd6.js → components/DesignableSwitch.d.ts} +6 -2
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/locale.d.ts +54 -0
- package/dist/client-v2/plugin.d.ts +8 -0
- package/dist/externalVersion.js +10 -10
- package/dist/{client-v2/193.3245b23f17b4c9f8.js → server/actions/apply-data-permissions.d.ts} +2 -2
- package/dist/server/actions/apply-data-permissions.js +208 -0
- package/dist/server/actions/data-source-compat.d.ts +13 -0
- package/dist/server/actions/data-source-compat.js +189 -0
- package/dist/server/server.js +16 -0
- package/dist/swagger/index.d.ts +149 -0
- package/dist/swagger/index.js +139 -4
- package/package.json +2 -2
- package/dist/client-v2/139.929bc11d582ef7d4.js +0 -10
- package/dist/client-v2/366.069b6cf12cfb9a67.js +0 -10
|
@@ -6,5 +6,9 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* v2 右上角 UI Editor 开关。
|
|
12
|
+
*/
|
|
13
|
+
export declare const DesignableSwitch: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<unknown>>;
|
|
14
|
+
export default DesignableSwitch;
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@formily/react"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-acl",["@nocobase/client-v2","@formily/core","react","antd","@formily/react","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-acl"]=t(require("@nocobase/client-v2"),require("@formily/core"),require("react"),require("antd"),require("@formily/react"),require("@nocobase/flow-engine")):e["@nocobase/plugin-acl"]=t(e["@nocobase/client-v2"],e["@formily/core"],e.react,e.antd,e["@formily/react"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i){return function(){"use strict";var c,a,u,l={452:function(e){e.exports=t},230:function(e){e.exports=o},485:function(t){t.exports=e},694:function(e){e.exports=i},59:function(e){e.exports=r},155:function(e){e.exports=n}},f={};function p(e){var t=f[e];if(void 0!==t)return t.exports;var n=f[e]={exports:{}};return l[e](n,n.exports,p),n.exports}p.m=l,p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,{a:t}),t},p.d=function(e,t){for(var n in t)p.o(t,n)&&!p.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},p.f={},p.e=function(e){return Promise.all(Object.keys(p.f).reduce(function(t,n){return p.f[n](e,t),t},[]))},p.u=function(e){return""+e+"."+({139:"929bc11d582ef7d4",193:"3245b23f17b4c9f8",366:"069b6cf12cfb9a67",627:"ce101823deb86dd6"})[e]+".js"},p.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s={},p.l=function(e,t,n,r){if(s[e])return void s[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),a=0;a<c.length;a++){var u=c[a];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-acl:"+n){o=u;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,p.nc&&o.setAttribute("nonce",p.nc),o.setAttribute("data-rspack","@nocobase/plugin-acl:"+n),o.src=e),s[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=s[e];if(delete s[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},p.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},p.g.importScripts&&(d=p.g.location+"");var s,d,b=p.g.document;if(!d&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(d=b.currentScript.src),!d)){var h=b.getElementsByTagName("script");if(h.length)for(var v=h.length-1;v>-1&&(!d||!/^http(s?):/.test(d));)d=h[v--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");p.p=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},p.f.j=function(e,t){var n=p.o(c,e)?c[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=c[e]=[t,r]});t.push(n[2]=r);var o=p.p+p.u(e),i=Error();p.l(o,function(t){if(p.o(c,e)&&(0!==(n=c[e])&&(c[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],u=0;if(o.some(function(e){return 0!==c[e]})){for(n in i)p.o(i,n)&&(p.m[n]=i[n]);a&&a(p)}for(e&&e(t);u<o.length;u++)r=o[u],p.o(c,r)&&c[r]&&c[r][0](),c[r]=0},(u=self.webpackChunk_nocobase_plugin_acl=self.webpackChunk_nocobase_plugin_acl||[]).forEach(a.bind(null,0)),u.push=a.bind(null,u.push.bind(u));var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-acl/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-acl/dist/client-v2/"}p.p=e}(),!function(){p.r(y),p.d(y,{default:function(){return a}});var e=p(485);function t(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function n(e,t,r){return(n=c()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i}).apply(null,arguments)}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return n(e,arguments,r(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,e)})(e)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var a=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=r(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(e,t||[],r(this).constructor):e.apply(this,t))}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&o(i,e),n=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(c,"next",{value:u(0)}),a(c,"throw",{value:u(1)}),a(c,"return",{value:u(2)}),"function"==typeof Symbol&&a(c,Symbol.iterator,{value:function(){return this}}),c;function u(a){return function(u){var l=[a,u];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:this.flowEngine.flowSettings.registerComponentLoaders({DemoFlowSettingsLazyField:function(){return p.e("193").then(p.bind(p,296))}}),this.router.add("acl-v2.homepage",{path:"/v2-demo/",componentLoader:function(){return p.e("366").then(p.bind(p,173))}}),this.router.add("acl-v2.app-info",{path:"/v2-demo/app-info",componentLoader:function(){return p.e("627").then(p.bind(p,726))}}),this.router.add("acl-v2.flow-settings-component-loader",{path:"/v2-demo/flow-settings-component-loader",componentLoader:function(){return p.e("139").then(p.bind(p,870))}}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.app.apiClient.request({url:"app:getInfo"})];case 2:return console.log("[client-v2 demo plugin] /api/app:getInfo",null==(e=t.sent())?void 0:e.data),[3,4];case 3:return console.error("[client-v2 demo plugin] failed to request /api/app:getInfo",t.sent()),[3,4];case 4:return[2]}})},function(){var n=this,r=arguments;return new Promise(function(o,i){var c=e.apply(n,r);function a(e){t(c,o,i,a,u,"next",e)}function u(e){t(c,o,i,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,n),i}(i(e.Plugin))}(),y}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client-v2")):"function"==typeof define&&define.amd?define("@nocobase/plugin-acl",["@nocobase/client-v2"],t):"object"==typeof exports?exports["@nocobase/plugin-acl"]=t(require("@nocobase/client-v2")):e["@nocobase/plugin-acl"]=t(e["@nocobase/client-v2"])}(self,function(e){return function(){"use strict";var t={485:function(t){t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.g.importScripts&&(r=o.g.location+"");var r,i=o.g.document;if(!r&&i&&(i.currentScript&&"SCRIPT"===i.currentScript.tagName.toUpperCase()&&(r=i.currentScript.src),!r)){var l=i.getElementsByTagName("script");if(l.length)for(var s=l.length-1;s>-1&&(!r||!/^http(s?):/.test(r));)r=l[s--].src}if(!r)throw Error("Automatic publicPath is not supported in this browser");o.p=r.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var u={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-acl/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",i=r.indexOf("/v2/");e=i>=0?r.slice(0,i+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-acl/dist/client-v2/"}o.p=e}(),!function(){o.r(u),o.d(u,{default:function(){return P}});var e=o(485),t={"en-US":JSON.parse('{"Allow roles union":"Allow roles union","Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.":"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.","Data sources":"Data sources","Desktop menu":"Desktop menu","Do not use role union. Users need to switch between their roles individually.":"Do not use role union. Users need to switch between their roles individually.","Force users to use only role union. They cannot switch between individual roles.":"Force users to use only role union. They cannot switch between individual roles.","Full permissions":"Full permissions","General":"General","Independent roles":"Independent roles","New role":"New role","Permissions":"Permissions","Please select role mode":"Please select role mode","Plugin settings":"Plugin settings","Role mode":"Role mode","Role mode doc":"https://docs.nocobase.com/handbook/acl/manual","Roles & Permissions":"Roles & Permissions","Roles union only":"Roles union only","Saved successfully":"Saved successfully","The current user has no roles. Please try another account.":"The current user has no roles. Please try another account.","The user role does not exist. Please try signing in again":"The user role does not exist. Please try signing in again"}'),"zh-CN":JSON.parse('{"Allow roles union":"允许角色并集","Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.":"允许用户使用角色并集,即可以同时使用自己拥有的所有角色的权限,也允许用户逐个切换自己的角色。","Data sources":"数据源","Desktop menu":"桌面端菜单","Do not use role union. Users need to switch between their roles individually.":"不使用角色并集,用户需要逐个切换自己拥有的角色。","Force users to use only role union. They cannot switch between individual roles.":"强制用户仅能使用角色并集,不能逐个切换角色。","Full permissions":"全部权限","General":"通用","Independent roles":"独立角色","New role":"新建角色","Permissions":"权限","Please select role mode":"请选择角色模式","Plugin settings":"插件设置","Role mode":"角色模式","Role mode doc":"https://docs-cn.nocobase.com/handbook/acl/manual","Roles & Permissions":"角色和权限","Roles union only":"仅角色并集","Saved successfully":"保存成功","The current user has no roles. Please try another account.":"当前用户没有角色,请使用其他账号。","The user role does not exist. Please try signing in again":"用户角色不存在,请尝试重新登录。"}')};function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function r(e,t,n,o,r,i,l){try{var s=e[i](l),u=s.value}catch(e){n(e);return}s.done?t(u):Promise.resolve(u).then(o,r)}function i(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var l=e.apply(t,n);function s(e){r(l,o,i,s,u,"next",e)}function u(e){r(l,o,i,s,u,"throw",e)}s(void 0)})}}function l(e,t,n){return t=h(t),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,m()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function s(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function a(e,t,n){return(a=m()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&y(r,n.prototype),r}).apply(null,arguments)}function c(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function p(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e,t){if(e){if("string"==typeof e)return n(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if("Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o)return Array.from(o);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(e,t)}}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,h(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,e)})(e)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function w(e,t){var n,o,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(l,"next",{value:u(0)}),s(l,"throw",{value:u(1)}),s(l,"return",{value:u(2)}),"function"==typeof Symbol&&s(l,Symbol.iterator,{value:function(){return this}}),l;function u(s){return function(u){var a=[s,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&a[0]?o.return:a[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;switch(o=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(6===a[0]&&i.label<r[1]){i.label=r[1],r=a;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(a);break}r[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var g=function(e){function t(){var e;return s(this,t),e=l(this,t,arguments),f(e,"section","preferences"),f(e,"sort",300),f(e,"label","Switch role"),e}return d(t,e),p(t,[{key:"prepare",value:function(){return i(function(){var e,t,o,r,i,l,s,u;return w(this,function(a){return i=Array.isArray(null==(e=this.context.user)?void 0:e.roles)?this.context.user.roles:[],l=null==(o=this.context.acl)||null==(t=o.data)?void 0:t.roleMode,s=this.context.api.auth.role,u=function(e){if(Array.isArray(e))return n(e)}(i)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||b(i)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),"allow-use-union"===l&&u.unshift({name:"__union__",title:this.context.t("Full permissions",{ns:"@nocobase/plugin-acl"})}),this.options=u.map(function(e){return{value:e.name,label:e.title||e.name}}),this.value=s||(null==(r=this.options[0])?void 0:r.value),this.ready=this.options.length>1&&"only-use-union"!==l,[2]})}).call(this)}},{key:"onChange",value:function(e){return i(function(){return w(this,function(t){switch(t.label){case 0:return this.context.api.auth.setRole(e),[4,this.context.api.resource("users").setDefaultRole({values:{roleName:e}})];case 1:return t.sent(),window.location.reload(),[2]}})}).call(this)}}]),t}(e.UserCenterSelectItemModel);f(g,"itemId","switch-role");var P=function(n){function o(){return s(this,o),l(this,o,arguments)}return d(o,n),p(o,[{key:"load",value:function(){return i(function(){var n;return w(this,function(o){return n=this,Object.entries(t).forEach(function(e){var t,o=function(e){if(Array.isArray(e))return e}(e)||function(e){var t,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var r=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(t=o.next()).done)&&(r.push(t.value),2!==r.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw n}}return r}}(e)||b(e,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),r=o[0],i=o[1];n.app.i18n.addResources(r,(null==(t=n.options)?void 0:t.packageName)||"@nocobase/plugin-acl",i)}),this.app.use(e.ACLRolesCheckProvider),this.app.flowEngine.registerModels({UIEditorTopbarActionModel:e.UIEditorTopbarActionModel,SwitchRoleItemModel:g}),[2]})}).call(this)}}]),o}(v(e.Plugin))}(),u}()});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const aclLocaleResources: {
|
|
10
|
+
'en-US': {
|
|
11
|
+
"Allow roles union": string;
|
|
12
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": string;
|
|
13
|
+
"Data sources": string;
|
|
14
|
+
"Desktop menu": string;
|
|
15
|
+
"Do not use role union. Users need to switch between their roles individually.": string;
|
|
16
|
+
"Force users to use only role union. They cannot switch between individual roles.": string;
|
|
17
|
+
"Full permissions": string;
|
|
18
|
+
General: string;
|
|
19
|
+
"Independent roles": string;
|
|
20
|
+
"New role": string;
|
|
21
|
+
Permissions: string;
|
|
22
|
+
"Please select role mode": string;
|
|
23
|
+
"Plugin settings": string;
|
|
24
|
+
"Role mode": string;
|
|
25
|
+
"Role mode doc": string;
|
|
26
|
+
"Roles & Permissions": string;
|
|
27
|
+
"Roles union only": string;
|
|
28
|
+
"Saved successfully": string;
|
|
29
|
+
"The current user has no roles. Please try another account.": string;
|
|
30
|
+
"The user role does not exist. Please try signing in again": string;
|
|
31
|
+
};
|
|
32
|
+
'zh-CN': {
|
|
33
|
+
"Allow roles union": string;
|
|
34
|
+
"Allow users to use role union, which means they can use permissions from all their roles simultaneously, or switch between individual roles.": string;
|
|
35
|
+
"Data sources": string;
|
|
36
|
+
"Desktop menu": string;
|
|
37
|
+
"Do not use role union. Users need to switch between their roles individually.": string;
|
|
38
|
+
"Force users to use only role union. They cannot switch between individual roles.": string;
|
|
39
|
+
"Full permissions": string;
|
|
40
|
+
General: string;
|
|
41
|
+
"Independent roles": string;
|
|
42
|
+
"New role": string;
|
|
43
|
+
Permissions: string;
|
|
44
|
+
"Please select role mode": string;
|
|
45
|
+
"Plugin settings": string;
|
|
46
|
+
"Role mode": string;
|
|
47
|
+
"Role mode doc": string;
|
|
48
|
+
"Roles & Permissions": string;
|
|
49
|
+
"Roles union only": string;
|
|
50
|
+
"Saved successfully": string;
|
|
51
|
+
"The current user has no roles. Please try another account.": string;
|
|
52
|
+
"The user role does not exist. Please try signing in again": string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
1
9
|
import { Plugin } from '@nocobase/client-v2';
|
|
2
10
|
export declare class PluginAclClientV2 extends Plugin {
|
|
3
11
|
load(): Promise<void>;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
11
|
+
"@nocobase/client": "2.1.0-alpha.23",
|
|
12
12
|
"antd": "5.24.2",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"react-i18next": "11.18.6",
|
|
@@ -17,16 +17,16 @@ module.exports = {
|
|
|
17
17
|
"@formily/react": "2.3.7",
|
|
18
18
|
"@ant-design/icons": "5.6.1",
|
|
19
19
|
"lodash": "4.18.1",
|
|
20
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
21
|
-
"@nocobase/client-v2": "2.1.0-alpha.
|
|
22
|
-
"@nocobase/actions": "2.1.0-alpha.
|
|
23
|
-
"@nocobase/cache": "2.1.0-alpha.
|
|
24
|
-
"@nocobase/database": "2.1.0-alpha.
|
|
25
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
26
|
-
"@nocobase/acl": "2.1.0-alpha.
|
|
27
|
-
"@nocobase/test": "2.1.0-alpha.
|
|
20
|
+
"@nocobase/utils": "2.1.0-alpha.23",
|
|
21
|
+
"@nocobase/client-v2": "2.1.0-alpha.23",
|
|
22
|
+
"@nocobase/actions": "2.1.0-alpha.23",
|
|
23
|
+
"@nocobase/cache": "2.1.0-alpha.23",
|
|
24
|
+
"@nocobase/database": "2.1.0-alpha.23",
|
|
25
|
+
"@nocobase/server": "2.1.0-alpha.23",
|
|
26
|
+
"@nocobase/acl": "2.1.0-alpha.23",
|
|
27
|
+
"@nocobase/test": "2.1.0-alpha.23",
|
|
28
28
|
"@formily/core": "2.3.7",
|
|
29
29
|
"@formily/antd-v5": "1.2.3",
|
|
30
30
|
"antd-style": "3.7.1",
|
|
31
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
31
|
+
"@nocobase/flow-engine": "2.1.0-alpha.23"
|
|
32
32
|
};
|
package/dist/{client-v2/193.3245b23f17b4c9f8.js → server/actions/apply-data-permissions.d.ts}
RENAMED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import type { Context, Next } from '@nocobase/actions';
|
|
10
|
+
export declare function applyDataPermissions(ctx: Context, next: Next): Promise<void>;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var apply_data_permissions_exports = {};
|
|
28
|
+
__export(apply_data_permissions_exports, {
|
|
29
|
+
applyDataPermissions: () => applyDataPermissions
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(apply_data_permissions_exports);
|
|
32
|
+
function ensureString(value, fieldName) {
|
|
33
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
34
|
+
throw new Error(`Invalid ${fieldName}`);
|
|
35
|
+
}
|
|
36
|
+
return value.trim();
|
|
37
|
+
}
|
|
38
|
+
function normalizeFields(fields) {
|
|
39
|
+
if (!Array.isArray(fields)) {
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
const normalized = [
|
|
43
|
+
...new Set(fields.filter((field) => typeof field === "string" && !!field.trim()))
|
|
44
|
+
];
|
|
45
|
+
return normalized.length ? normalized : [];
|
|
46
|
+
}
|
|
47
|
+
function normalizeScopeId(scopeId) {
|
|
48
|
+
if (scopeId === null) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
if (scopeId === void 0) {
|
|
52
|
+
return void 0;
|
|
53
|
+
}
|
|
54
|
+
const parsed = Number(scopeId);
|
|
55
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
56
|
+
throw new Error(`Invalid scopeId: ${scopeId}`);
|
|
57
|
+
}
|
|
58
|
+
return parsed;
|
|
59
|
+
}
|
|
60
|
+
async function resolveScopeIdByKey(options) {
|
|
61
|
+
const scope = await options.ctx.db.getRepository("dataSourcesRolesResourcesScopes").findOne({
|
|
62
|
+
filter: {
|
|
63
|
+
dataSourceKey: options.dataSourceKey,
|
|
64
|
+
key: options.scopeKey
|
|
65
|
+
},
|
|
66
|
+
transaction: options.transaction
|
|
67
|
+
});
|
|
68
|
+
if (!scope) {
|
|
69
|
+
throw new Error(`Scope key "${options.scopeKey}" not found in data source "${options.dataSourceKey}"`);
|
|
70
|
+
}
|
|
71
|
+
return scope.get("id");
|
|
72
|
+
}
|
|
73
|
+
async function normalizeAction(options) {
|
|
74
|
+
const name = ensureString(options.action.name, "action.name");
|
|
75
|
+
let scopeId = normalizeScopeId(options.action.scopeId);
|
|
76
|
+
if (scopeId === void 0 && options.action.scope && typeof options.action.scope.id === "number") {
|
|
77
|
+
scopeId = normalizeScopeId(options.action.scope.id);
|
|
78
|
+
}
|
|
79
|
+
let scopeKey;
|
|
80
|
+
if (typeof options.action.scopeKey === "string" && options.action.scopeKey.trim()) {
|
|
81
|
+
scopeKey = options.action.scopeKey.trim();
|
|
82
|
+
} else if (options.action.scope && typeof options.action.scope.key === "string" && options.action.scope.key.trim()) {
|
|
83
|
+
scopeKey = options.action.scope.key.trim();
|
|
84
|
+
}
|
|
85
|
+
if (scopeId === void 0 && scopeKey) {
|
|
86
|
+
scopeId = await resolveScopeIdByKey({
|
|
87
|
+
ctx: options.ctx,
|
|
88
|
+
dataSourceKey: options.dataSourceKey,
|
|
89
|
+
scopeKey,
|
|
90
|
+
transaction: options.transaction
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (scopeId === void 0) {
|
|
94
|
+
scopeId = null;
|
|
95
|
+
}
|
|
96
|
+
const normalized = {
|
|
97
|
+
name,
|
|
98
|
+
fields: normalizeFields(options.action.fields),
|
|
99
|
+
scopeId
|
|
100
|
+
};
|
|
101
|
+
const output = {
|
|
102
|
+
name: normalized.name
|
|
103
|
+
};
|
|
104
|
+
if (normalized.fields !== void 0) {
|
|
105
|
+
output.fields = normalized.fields;
|
|
106
|
+
}
|
|
107
|
+
if (normalized.scopeId !== void 0) {
|
|
108
|
+
output.scopeId = normalized.scopeId;
|
|
109
|
+
}
|
|
110
|
+
return output;
|
|
111
|
+
}
|
|
112
|
+
async function applyDataPermissions(ctx, next) {
|
|
113
|
+
const roleName = ensureString(ctx.action.params.filterByTk, "filterByTk");
|
|
114
|
+
const values = ctx.action.params.values || {};
|
|
115
|
+
const dataSourceKey = ensureString(values.dataSourceKey || "main", "dataSourceKey");
|
|
116
|
+
const resources = values.resources;
|
|
117
|
+
if (!Array.isArray(resources) || resources.length === 0) {
|
|
118
|
+
throw new Error("`resources` must be a non-empty array");
|
|
119
|
+
}
|
|
120
|
+
const role = await ctx.db.getRepository("roles").findOne({
|
|
121
|
+
filterByTk: roleName
|
|
122
|
+
});
|
|
123
|
+
if (!role) {
|
|
124
|
+
throw new Error(`Role "${roleName}" not found`);
|
|
125
|
+
}
|
|
126
|
+
const roleResourceRepository = ctx.db.getRepository("roles.resources", roleName);
|
|
127
|
+
const appliedResources = [];
|
|
128
|
+
await ctx.db.sequelize.transaction(async (transaction) => {
|
|
129
|
+
for (const resourceInput of resources) {
|
|
130
|
+
const resourceName = ensureString(resourceInput == null ? void 0 : resourceInput.name, "resource.name");
|
|
131
|
+
const usingActionsConfig = (resourceInput == null ? void 0 : resourceInput.usingActionsConfig) ?? true;
|
|
132
|
+
const actionsInput = Array.isArray(resourceInput == null ? void 0 : resourceInput.actions) ? resourceInput.actions : [];
|
|
133
|
+
const normalizedActions = [];
|
|
134
|
+
for (const action of actionsInput) {
|
|
135
|
+
normalizedActions.push(
|
|
136
|
+
await normalizeAction({
|
|
137
|
+
ctx,
|
|
138
|
+
dataSourceKey,
|
|
139
|
+
action,
|
|
140
|
+
transaction
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
const existingResource = await roleResourceRepository.findOne({
|
|
145
|
+
filter: {
|
|
146
|
+
name: resourceName,
|
|
147
|
+
dataSourceKey
|
|
148
|
+
},
|
|
149
|
+
appends: ["actions"],
|
|
150
|
+
transaction
|
|
151
|
+
});
|
|
152
|
+
const writeValues = {
|
|
153
|
+
name: resourceName,
|
|
154
|
+
dataSourceKey,
|
|
155
|
+
usingActionsConfig,
|
|
156
|
+
actions: normalizedActions
|
|
157
|
+
};
|
|
158
|
+
let savedResource;
|
|
159
|
+
if (existingResource) {
|
|
160
|
+
await roleResourceRepository.update({
|
|
161
|
+
filterByTk: existingResource.get("id"),
|
|
162
|
+
values: writeValues,
|
|
163
|
+
updateAssociationValues: ["actions"],
|
|
164
|
+
transaction
|
|
165
|
+
});
|
|
166
|
+
savedResource = await roleResourceRepository.findOne({
|
|
167
|
+
filterByTk: existingResource.get("id"),
|
|
168
|
+
appends: ["actions"],
|
|
169
|
+
transaction
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
const created = await roleResourceRepository.create({
|
|
173
|
+
values: writeValues,
|
|
174
|
+
transaction
|
|
175
|
+
});
|
|
176
|
+
savedResource = await roleResourceRepository.findOne({
|
|
177
|
+
filterByTk: created.get("id"),
|
|
178
|
+
appends: ["actions"],
|
|
179
|
+
transaction
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const actionModels = savedResource.get("actions") || [];
|
|
183
|
+
appliedResources.push({
|
|
184
|
+
id: savedResource.get("id"),
|
|
185
|
+
name: savedResource.get("name"),
|
|
186
|
+
dataSourceKey: savedResource.get("dataSourceKey"),
|
|
187
|
+
usingActionsConfig: !!savedResource.get("usingActionsConfig"),
|
|
188
|
+
actions: actionModels.map((actionModel) => ({
|
|
189
|
+
id: actionModel.get("id"),
|
|
190
|
+
name: actionModel.get("name"),
|
|
191
|
+
fields: actionModel.get("fields") || [],
|
|
192
|
+
scopeId: actionModel.get("scopeId") ?? null
|
|
193
|
+
}))
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
ctx.body = {
|
|
198
|
+
roleName,
|
|
199
|
+
dataSourceKey,
|
|
200
|
+
resources: appliedResources,
|
|
201
|
+
count: appliedResources.length
|
|
202
|
+
};
|
|
203
|
+
await next();
|
|
204
|
+
}
|
|
205
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
206
|
+
0 && (module.exports = {
|
|
207
|
+
applyDataPermissions
|
|
208
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Context, Next } from '@nocobase/actions';
|
|
10
|
+
export declare function guardRolesDataSourcesCollectionsList(ctx: Context, next: Next): Promise<void>;
|
|
11
|
+
export declare function guardRolesDataSourceResourcesCreate(ctx: Context, next: Next): Promise<void>;
|
|
12
|
+
export declare function guardRolesDataSourceResourcesGet(ctx: Context, next: Next): Promise<void>;
|
|
13
|
+
export declare function guardRolesDataSourceResourcesUpdate(ctx: Context, next: Next): Promise<void>;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var data_source_compat_exports = {};
|
|
38
|
+
__export(data_source_compat_exports, {
|
|
39
|
+
guardRolesDataSourceResourcesCreate: () => guardRolesDataSourceResourcesCreate,
|
|
40
|
+
guardRolesDataSourceResourcesGet: () => guardRolesDataSourceResourcesGet,
|
|
41
|
+
guardRolesDataSourceResourcesUpdate: () => guardRolesDataSourceResourcesUpdate,
|
|
42
|
+
guardRolesDataSourcesCollectionsList: () => guardRolesDataSourcesCollectionsList
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(data_source_compat_exports);
|
|
45
|
+
var import_lodash = __toESM(require("lodash"));
|
|
46
|
+
function normalizeString(value) {
|
|
47
|
+
if (typeof value !== "string") {
|
|
48
|
+
return void 0;
|
|
49
|
+
}
|
|
50
|
+
const trimmed = value.trim();
|
|
51
|
+
return trimmed ? trimmed : void 0;
|
|
52
|
+
}
|
|
53
|
+
function normalizeFilter(input) {
|
|
54
|
+
if (!import_lodash.default.isPlainObject(input)) {
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
return { ...input };
|
|
58
|
+
}
|
|
59
|
+
function applyLocatorFromQuery(params, filter) {
|
|
60
|
+
const dataSourceKeyFromQuery = normalizeString(params.dataSourceKey);
|
|
61
|
+
if (dataSourceKeyFromQuery) {
|
|
62
|
+
filter.dataSourceKey = filter.dataSourceKey || dataSourceKeyFromQuery;
|
|
63
|
+
}
|
|
64
|
+
const nameFromQuery = normalizeString(params.name);
|
|
65
|
+
if (nameFromQuery) {
|
|
66
|
+
filter.name = filter.name || nameFromQuery;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function normalizeNumericTk(value) {
|
|
70
|
+
if (typeof value === "number" && Number.isInteger(value) && value >= 0) {
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
const normalized = normalizeString(value);
|
|
74
|
+
if (!normalized || !/^\d+$/.test(normalized)) {
|
|
75
|
+
return void 0;
|
|
76
|
+
}
|
|
77
|
+
return normalized;
|
|
78
|
+
}
|
|
79
|
+
function deriveNameFromPrefixedTk(value) {
|
|
80
|
+
const normalized = normalizeString(value);
|
|
81
|
+
if (!normalized) {
|
|
82
|
+
return void 0;
|
|
83
|
+
}
|
|
84
|
+
const matched = normalized.match(/^[a-zA-Z]+_(.+)$/);
|
|
85
|
+
if (!matched) {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
return normalizeString(matched[1]);
|
|
89
|
+
}
|
|
90
|
+
async function resolveLocatorFromFilterByTk(ctx, roleName, filter) {
|
|
91
|
+
const rawFilterByTk = ctx.action.params.filterByTk;
|
|
92
|
+
if (rawFilterByTk === void 0 || rawFilterByTk === null || rawFilterByTk === "") {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const numericFilterByTk = normalizeNumericTk(rawFilterByTk);
|
|
96
|
+
if (numericFilterByTk === void 0) {
|
|
97
|
+
if (!normalizeString(filter.name)) {
|
|
98
|
+
const derivedName = deriveNameFromPrefixedTk(rawFilterByTk);
|
|
99
|
+
if (derivedName) {
|
|
100
|
+
filter.name = derivedName;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const resource = await ctx.db.getRepository("dataSourcesRolesResources").findOne({
|
|
106
|
+
filterByTk: numericFilterByTk
|
|
107
|
+
});
|
|
108
|
+
if (!resource) {
|
|
109
|
+
ctx.throw(404, `Resource permission not found by filterByTk "${rawFilterByTk}"`);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const targetRoleName = resource.get("roleName");
|
|
113
|
+
if (targetRoleName !== roleName) {
|
|
114
|
+
ctx.throw(400, `Resource permission "${rawFilterByTk}" does not belong to role "${roleName}"`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (!normalizeString(filter.dataSourceKey)) {
|
|
118
|
+
filter.dataSourceKey = resource.get("dataSourceKey");
|
|
119
|
+
}
|
|
120
|
+
if (!normalizeString(filter.name)) {
|
|
121
|
+
filter.name = resource.get("name");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function normalizeRoleDataSourceResourceLocator(ctx) {
|
|
125
|
+
const roleName = normalizeString(ctx.action.params.associatedIndex);
|
|
126
|
+
if (!roleName) {
|
|
127
|
+
ctx.throw(400, "Role name is required");
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const filter = normalizeFilter(ctx.action.params.filter);
|
|
131
|
+
applyLocatorFromQuery(ctx.action.params, filter);
|
|
132
|
+
await resolveLocatorFromFilterByTk(ctx, roleName, filter);
|
|
133
|
+
const dataSourceKey = normalizeString(filter.dataSourceKey);
|
|
134
|
+
const name = normalizeString(filter.name);
|
|
135
|
+
if (!dataSourceKey || !name) {
|
|
136
|
+
ctx.throw(
|
|
137
|
+
400,
|
|
138
|
+
"Missing resource locator: provide --filter-by-tk, or both --data-source-key and --name (or filter.{dataSourceKey,name})"
|
|
139
|
+
);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
ctx.action.params.filter = {
|
|
143
|
+
...filter,
|
|
144
|
+
dataSourceKey,
|
|
145
|
+
name
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
async function guardRolesDataSourcesCollectionsList(ctx, next) {
|
|
149
|
+
const filter = normalizeFilter(ctx.action.params.filter);
|
|
150
|
+
applyLocatorFromQuery(ctx.action.params, filter);
|
|
151
|
+
const dataSourceKey = normalizeString(filter.dataSourceKey);
|
|
152
|
+
if (!dataSourceKey) {
|
|
153
|
+
ctx.throw(400, "dataSourceKey is required: pass --data-source-key or filter.dataSourceKey");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
ctx.action.params.filter = {
|
|
157
|
+
...filter,
|
|
158
|
+
dataSourceKey
|
|
159
|
+
};
|
|
160
|
+
await next();
|
|
161
|
+
}
|
|
162
|
+
async function guardRolesDataSourceResourcesCreate(ctx, next) {
|
|
163
|
+
const values = normalizeFilter(ctx.action.params.values);
|
|
164
|
+
const dataSourceKeyFromQuery = normalizeString(ctx.action.params.dataSourceKey);
|
|
165
|
+
if (!values.dataSourceKey && dataSourceKeyFromQuery) {
|
|
166
|
+
values.dataSourceKey = dataSourceKeyFromQuery;
|
|
167
|
+
}
|
|
168
|
+
if (!normalizeString(values.dataSourceKey)) {
|
|
169
|
+
ctx.throw(400, "dataSourceKey is required for roles.dataSourceResources:create");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
ctx.action.params.values = values;
|
|
173
|
+
await next();
|
|
174
|
+
}
|
|
175
|
+
async function guardRolesDataSourceResourcesGet(ctx, next) {
|
|
176
|
+
await normalizeRoleDataSourceResourceLocator(ctx);
|
|
177
|
+
await next();
|
|
178
|
+
}
|
|
179
|
+
async function guardRolesDataSourceResourcesUpdate(ctx, next) {
|
|
180
|
+
await normalizeRoleDataSourceResourceLocator(ctx);
|
|
181
|
+
await next();
|
|
182
|
+
}
|
|
183
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
184
|
+
0 && (module.exports = {
|
|
185
|
+
guardRolesDataSourceResourcesCreate,
|
|
186
|
+
guardRolesDataSourceResourcesGet,
|
|
187
|
+
guardRolesDataSourceResourcesUpdate,
|
|
188
|
+
guardRolesDataSourcesCollectionsList
|
|
189
|
+
});
|
package/dist/server/server.js
CHANGED
|
@@ -46,6 +46,8 @@ var import_server = require("@nocobase/server");
|
|
|
46
46
|
var import_lodash = __toESM(require("lodash"));
|
|
47
47
|
var import_path = require("path");
|
|
48
48
|
var import_available_actions = require("./actions/available-actions");
|
|
49
|
+
var import_apply_data_permissions = require("./actions/apply-data-permissions");
|
|
50
|
+
var import_data_source_compat = require("./actions/data-source-compat");
|
|
49
51
|
var import_role_check = require("./actions/role-check");
|
|
50
52
|
var import_role_collections = require("./actions/role-collections");
|
|
51
53
|
var import_user_setDefaultRole = require("./actions/user-setDefaultRole");
|
|
@@ -181,7 +183,21 @@ class PluginACLServer extends import_server.Plugin {
|
|
|
181
183
|
this.app.resourcer.define(import_available_actions.availableActionResource);
|
|
182
184
|
this.app.resourcer.define(import_role_collections.roleCollectionsResource);
|
|
183
185
|
this.app.resourcer.registerActionHandler("roles:setSystemRoleMode", import_union_role.setSystemRoleMode);
|
|
186
|
+
this.app.resourcer.registerActionHandler("roles:applyDataPermissions", import_apply_data_permissions.applyDataPermissions);
|
|
184
187
|
this.app.resourcer.registerActionHandler("roles:check", import_role_check.checkAction);
|
|
188
|
+
this.app.resourcer.registerPreActionHandler(
|
|
189
|
+
"roles.dataSourcesCollections:list",
|
|
190
|
+
import_data_source_compat.guardRolesDataSourcesCollectionsList
|
|
191
|
+
);
|
|
192
|
+
this.app.resourcer.registerPreActionHandler(
|
|
193
|
+
"roles.dataSourceResources:create",
|
|
194
|
+
import_data_source_compat.guardRolesDataSourceResourcesCreate
|
|
195
|
+
);
|
|
196
|
+
this.app.resourcer.registerPreActionHandler("roles.dataSourceResources:get", import_data_source_compat.guardRolesDataSourceResourcesGet);
|
|
197
|
+
this.app.resourcer.registerPreActionHandler(
|
|
198
|
+
"roles.dataSourceResources:update",
|
|
199
|
+
import_data_source_compat.guardRolesDataSourceResourcesUpdate
|
|
200
|
+
);
|
|
185
201
|
this.app.resourcer.registerActionHandler(`users:setDefaultRole`, import_user_setDefaultRole.setDefaultRole);
|
|
186
202
|
this.db.on("users.afterCreateWithAssociations", async (model, options) => {
|
|
187
203
|
const { transaction } = options;
|
package/dist/swagger/index.d.ts
CHANGED
|
@@ -198,6 +198,38 @@ declare const _default: {
|
|
|
198
198
|
};
|
|
199
199
|
};
|
|
200
200
|
};
|
|
201
|
+
'/roles:applyDataPermissions': {
|
|
202
|
+
post: {
|
|
203
|
+
tags: string[];
|
|
204
|
+
summary: string;
|
|
205
|
+
description: string;
|
|
206
|
+
parameters: {
|
|
207
|
+
$ref: string;
|
|
208
|
+
}[];
|
|
209
|
+
requestBody: {
|
|
210
|
+
required: boolean;
|
|
211
|
+
content: {
|
|
212
|
+
'application/json': {
|
|
213
|
+
schema: {
|
|
214
|
+
$ref: string;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
responses: {
|
|
220
|
+
200: {
|
|
221
|
+
description: string;
|
|
222
|
+
content: {
|
|
223
|
+
'application/json': {
|
|
224
|
+
schema: {
|
|
225
|
+
$ref: string;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
201
233
|
'/roles/{roleName}/users:list': {
|
|
202
234
|
get: {
|
|
203
235
|
tags: string[];
|
|
@@ -744,6 +776,14 @@ declare const _default: {
|
|
|
744
776
|
type: string;
|
|
745
777
|
};
|
|
746
778
|
};
|
|
779
|
+
DataSourceKeyQuery: {
|
|
780
|
+
name: string;
|
|
781
|
+
in: string;
|
|
782
|
+
description: string;
|
|
783
|
+
schema: {
|
|
784
|
+
type: string;
|
|
785
|
+
};
|
|
786
|
+
};
|
|
747
787
|
MembershipUserFilterByTkQuery: {
|
|
748
788
|
name: string;
|
|
749
789
|
in: string;
|
|
@@ -789,6 +829,14 @@ declare const _default: {
|
|
|
789
829
|
type: string;
|
|
790
830
|
};
|
|
791
831
|
};
|
|
832
|
+
DataSourceResourceNameQuery: {
|
|
833
|
+
name: string;
|
|
834
|
+
in: string;
|
|
835
|
+
description: string;
|
|
836
|
+
schema: {
|
|
837
|
+
type: string;
|
|
838
|
+
};
|
|
839
|
+
};
|
|
792
840
|
ScopePkQuery: {
|
|
793
841
|
name: string;
|
|
794
842
|
in: string;
|
|
@@ -951,6 +999,107 @@ declare const _default: {
|
|
|
951
999
|
};
|
|
952
1000
|
required: string[];
|
|
953
1001
|
};
|
|
1002
|
+
RoleDataPermissionActionWrite: {
|
|
1003
|
+
type: string;
|
|
1004
|
+
properties: {
|
|
1005
|
+
name: {
|
|
1006
|
+
type: string;
|
|
1007
|
+
description: string;
|
|
1008
|
+
};
|
|
1009
|
+
fields: {
|
|
1010
|
+
type: string;
|
|
1011
|
+
items: {
|
|
1012
|
+
type: string;
|
|
1013
|
+
};
|
|
1014
|
+
description: string;
|
|
1015
|
+
};
|
|
1016
|
+
scopeId: {
|
|
1017
|
+
type: string;
|
|
1018
|
+
nullable: boolean;
|
|
1019
|
+
description: string;
|
|
1020
|
+
};
|
|
1021
|
+
scopeKey: {
|
|
1022
|
+
type: string;
|
|
1023
|
+
description: string;
|
|
1024
|
+
};
|
|
1025
|
+
scope: {
|
|
1026
|
+
type: string;
|
|
1027
|
+
properties: {
|
|
1028
|
+
id: {
|
|
1029
|
+
type: string;
|
|
1030
|
+
};
|
|
1031
|
+
key: {
|
|
1032
|
+
type: string;
|
|
1033
|
+
};
|
|
1034
|
+
};
|
|
1035
|
+
additionalProperties: boolean;
|
|
1036
|
+
description: string;
|
|
1037
|
+
};
|
|
1038
|
+
};
|
|
1039
|
+
required: string[];
|
|
1040
|
+
additionalProperties: boolean;
|
|
1041
|
+
};
|
|
1042
|
+
RoleDataPermissionResourceWrite: {
|
|
1043
|
+
type: string;
|
|
1044
|
+
properties: {
|
|
1045
|
+
name: {
|
|
1046
|
+
type: string;
|
|
1047
|
+
description: string;
|
|
1048
|
+
};
|
|
1049
|
+
usingActionsConfig: {
|
|
1050
|
+
type: string;
|
|
1051
|
+
description: string;
|
|
1052
|
+
};
|
|
1053
|
+
actions: {
|
|
1054
|
+
type: string;
|
|
1055
|
+
items: {
|
|
1056
|
+
$ref: string;
|
|
1057
|
+
};
|
|
1058
|
+
description: string;
|
|
1059
|
+
};
|
|
1060
|
+
};
|
|
1061
|
+
required: string[];
|
|
1062
|
+
additionalProperties: boolean;
|
|
1063
|
+
};
|
|
1064
|
+
RoleDataPermissionsApplyWrite: {
|
|
1065
|
+
type: string;
|
|
1066
|
+
properties: {
|
|
1067
|
+
dataSourceKey: {
|
|
1068
|
+
type: string;
|
|
1069
|
+
description: string;
|
|
1070
|
+
};
|
|
1071
|
+
resources: {
|
|
1072
|
+
type: string;
|
|
1073
|
+
items: {
|
|
1074
|
+
$ref: string;
|
|
1075
|
+
};
|
|
1076
|
+
description: string;
|
|
1077
|
+
};
|
|
1078
|
+
};
|
|
1079
|
+
required: string[];
|
|
1080
|
+
additionalProperties: boolean;
|
|
1081
|
+
};
|
|
1082
|
+
RoleDataPermissionsApplyResult: {
|
|
1083
|
+
type: string;
|
|
1084
|
+
properties: {
|
|
1085
|
+
roleName: {
|
|
1086
|
+
type: string;
|
|
1087
|
+
};
|
|
1088
|
+
dataSourceKey: {
|
|
1089
|
+
type: string;
|
|
1090
|
+
};
|
|
1091
|
+
count: {
|
|
1092
|
+
type: string;
|
|
1093
|
+
};
|
|
1094
|
+
resources: {
|
|
1095
|
+
type: string;
|
|
1096
|
+
items: {
|
|
1097
|
+
$ref: string;
|
|
1098
|
+
};
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1101
|
+
additionalProperties: boolean;
|
|
1102
|
+
};
|
|
954
1103
|
DataSourceRole: {
|
|
955
1104
|
type: string;
|
|
956
1105
|
properties: {
|
package/dist/swagger/index.js
CHANGED
|
@@ -213,6 +213,36 @@ var swagger_default = {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
|
+
"/roles:applyDataPermissions": {
|
|
217
|
+
post: {
|
|
218
|
+
tags: ["roles"],
|
|
219
|
+
summary: "Apply collection-level independent ACL permissions in batch for a role",
|
|
220
|
+
description: "Apply one or more collection-level independent ACL permission configs for a role in one request. Supports action scope binding by `scopeId` or `scopeKey`.",
|
|
221
|
+
parameters: [{ $ref: "#/components/parameters/RoleNameQuery" }],
|
|
222
|
+
requestBody: {
|
|
223
|
+
required: true,
|
|
224
|
+
content: {
|
|
225
|
+
"application/json": {
|
|
226
|
+
schema: {
|
|
227
|
+
$ref: "#/components/schemas/RoleDataPermissionsApplyWrite"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
responses: {
|
|
233
|
+
200: {
|
|
234
|
+
description: "OK",
|
|
235
|
+
content: {
|
|
236
|
+
"application/json": {
|
|
237
|
+
schema: {
|
|
238
|
+
$ref: "#/components/schemas/RoleDataPermissionsApplyResult"
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
216
246
|
"/roles/{roleName}/users:list": {
|
|
217
247
|
get: {
|
|
218
248
|
tags: ["roles.users"],
|
|
@@ -412,9 +442,10 @@ var swagger_default = {
|
|
|
412
442
|
get: {
|
|
413
443
|
tags: ["roles.dataSourcesCollections"],
|
|
414
444
|
summary: "List data-source collections in role permission configuration",
|
|
415
|
-
description: "List collections in the target data source for the given role and indicate whether they use global permissions or collection-level independent permissions.",
|
|
445
|
+
description: "List collections in the target data source for the given role and indicate whether they use global permissions or collection-level independent permissions. You can pass `dataSourceKey` directly, or through `filter.dataSourceKey` for compatibility.",
|
|
416
446
|
parameters: [
|
|
417
447
|
{ $ref: "#/components/parameters/RoleNamePath" },
|
|
448
|
+
{ $ref: "#/components/parameters/DataSourceKeyQuery" },
|
|
418
449
|
{ $ref: "#/components/parameters/PageQuery" },
|
|
419
450
|
{ $ref: "#/components/parameters/PageSizeQuery" },
|
|
420
451
|
{ $ref: "#/components/parameters/SortQuery" },
|
|
@@ -483,9 +514,12 @@ var swagger_default = {
|
|
|
483
514
|
get: {
|
|
484
515
|
tags: ["roles.dataSourceResources"],
|
|
485
516
|
summary: "Get one collection-level independent ACL permission for a role",
|
|
486
|
-
description: "Get one collection-level independent permission config.
|
|
517
|
+
description: "Get one collection-level independent permission config. You can target it by `filterByTk`, or by `name` + `dataSourceKey`. `filter` with `{ name, dataSourceKey }` is still supported for compatibility.",
|
|
487
518
|
parameters: [
|
|
488
519
|
{ $ref: "#/components/parameters/RoleNamePath" },
|
|
520
|
+
{ $ref: "#/components/parameters/ResourcePermissionTkQuery" },
|
|
521
|
+
{ $ref: "#/components/parameters/DataSourceKeyQuery" },
|
|
522
|
+
{ $ref: "#/components/parameters/DataSourceResourceNameQuery" },
|
|
489
523
|
{ $ref: "#/components/parameters/FilterQuery" },
|
|
490
524
|
{ $ref: "#/components/parameters/AppendsQuery" }
|
|
491
525
|
],
|
|
@@ -507,8 +541,14 @@ var swagger_default = {
|
|
|
507
541
|
post: {
|
|
508
542
|
tags: ["roles.dataSourceResources"],
|
|
509
543
|
summary: "Update collection-level independent ACL permissions for a role",
|
|
510
|
-
description: "Update one collection-level independent permission config.
|
|
511
|
-
parameters: [
|
|
544
|
+
description: "Update one collection-level independent permission config. You can target it by `filterByTk`, or by `name` + `dataSourceKey`. `filter` with `{ name, dataSourceKey }` is still supported for compatibility.",
|
|
545
|
+
parameters: [
|
|
546
|
+
{ $ref: "#/components/parameters/RoleNamePath" },
|
|
547
|
+
{ $ref: "#/components/parameters/ResourcePermissionTkQuery" },
|
|
548
|
+
{ $ref: "#/components/parameters/DataSourceKeyQuery" },
|
|
549
|
+
{ $ref: "#/components/parameters/DataSourceResourceNameQuery" },
|
|
550
|
+
{ $ref: "#/components/parameters/FilterQuery" }
|
|
551
|
+
],
|
|
512
552
|
requestBody: {
|
|
513
553
|
required: true,
|
|
514
554
|
content: {
|
|
@@ -765,6 +805,12 @@ var swagger_default = {
|
|
|
765
805
|
required: true,
|
|
766
806
|
schema: { type: "string" }
|
|
767
807
|
},
|
|
808
|
+
DataSourceKeyQuery: {
|
|
809
|
+
name: "dataSourceKey",
|
|
810
|
+
in: "query",
|
|
811
|
+
description: "Data source key, for example `main`.",
|
|
812
|
+
schema: { type: "string" }
|
|
813
|
+
},
|
|
768
814
|
MembershipUserFilterByTkQuery: {
|
|
769
815
|
name: "filterByTk",
|
|
770
816
|
in: "query",
|
|
@@ -807,6 +853,12 @@ var swagger_default = {
|
|
|
807
853
|
required: true,
|
|
808
854
|
schema: { type: "string" }
|
|
809
855
|
},
|
|
856
|
+
DataSourceResourceNameQuery: {
|
|
857
|
+
name: "name",
|
|
858
|
+
in: "query",
|
|
859
|
+
description: "Resource name, typically the collection name.",
|
|
860
|
+
schema: { type: "string" }
|
|
861
|
+
},
|
|
810
862
|
ScopePkQuery: {
|
|
811
863
|
name: "filterByTk",
|
|
812
864
|
in: "query",
|
|
@@ -919,6 +971,89 @@ var swagger_default = {
|
|
|
919
971
|
},
|
|
920
972
|
required: ["roleMode"]
|
|
921
973
|
},
|
|
974
|
+
RoleDataPermissionActionWrite: {
|
|
975
|
+
type: "object",
|
|
976
|
+
properties: {
|
|
977
|
+
name: {
|
|
978
|
+
type: "string",
|
|
979
|
+
description: "ACL action name, such as `view`, `create`, `update`, or `destroy`."
|
|
980
|
+
},
|
|
981
|
+
fields: {
|
|
982
|
+
type: "array",
|
|
983
|
+
items: { type: "string" },
|
|
984
|
+
description: "Optional allowed field list for field-configurable actions."
|
|
985
|
+
},
|
|
986
|
+
scopeId: {
|
|
987
|
+
type: "integer",
|
|
988
|
+
nullable: true,
|
|
989
|
+
description: "Optional scope id. Use `null` to clear the scope binding."
|
|
990
|
+
},
|
|
991
|
+
scopeKey: {
|
|
992
|
+
type: "string",
|
|
993
|
+
description: "Optional built-in/custom scope key. When provided, server resolves it to `scopeId`."
|
|
994
|
+
},
|
|
995
|
+
scope: {
|
|
996
|
+
type: "object",
|
|
997
|
+
properties: {
|
|
998
|
+
id: { type: "integer" },
|
|
999
|
+
key: { type: "string" }
|
|
1000
|
+
},
|
|
1001
|
+
additionalProperties: true,
|
|
1002
|
+
description: "Optional compatibility payload from existing role-resource readback."
|
|
1003
|
+
}
|
|
1004
|
+
},
|
|
1005
|
+
required: ["name"],
|
|
1006
|
+
additionalProperties: true
|
|
1007
|
+
},
|
|
1008
|
+
RoleDataPermissionResourceWrite: {
|
|
1009
|
+
type: "object",
|
|
1010
|
+
properties: {
|
|
1011
|
+
name: {
|
|
1012
|
+
type: "string",
|
|
1013
|
+
description: "Collection name."
|
|
1014
|
+
},
|
|
1015
|
+
usingActionsConfig: {
|
|
1016
|
+
type: "boolean",
|
|
1017
|
+
description: "Whether the collection uses independent action config."
|
|
1018
|
+
},
|
|
1019
|
+
actions: {
|
|
1020
|
+
type: "array",
|
|
1021
|
+
items: { $ref: "#/components/schemas/RoleDataPermissionActionWrite" },
|
|
1022
|
+
description: "Independent action config list for the collection."
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
required: ["name"],
|
|
1026
|
+
additionalProperties: true
|
|
1027
|
+
},
|
|
1028
|
+
RoleDataPermissionsApplyWrite: {
|
|
1029
|
+
type: "object",
|
|
1030
|
+
properties: {
|
|
1031
|
+
dataSourceKey: {
|
|
1032
|
+
type: "string",
|
|
1033
|
+
description: "Data source key, default is `main` when omitted."
|
|
1034
|
+
},
|
|
1035
|
+
resources: {
|
|
1036
|
+
type: "array",
|
|
1037
|
+
items: { $ref: "#/components/schemas/RoleDataPermissionResourceWrite" },
|
|
1038
|
+
description: "Collection-level independent permission payloads to apply in batch."
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
required: ["resources"],
|
|
1042
|
+
additionalProperties: true
|
|
1043
|
+
},
|
|
1044
|
+
RoleDataPermissionsApplyResult: {
|
|
1045
|
+
type: "object",
|
|
1046
|
+
properties: {
|
|
1047
|
+
roleName: { type: "string" },
|
|
1048
|
+
dataSourceKey: { type: "string" },
|
|
1049
|
+
count: { type: "integer" },
|
|
1050
|
+
resources: {
|
|
1051
|
+
type: "array",
|
|
1052
|
+
items: { $ref: "#/components/schemas/RoleDataSourceResource" }
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
additionalProperties: true
|
|
1056
|
+
},
|
|
922
1057
|
DataSourceRole: {
|
|
923
1058
|
type: "object",
|
|
924
1059
|
properties: {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
|
|
7
7
|
"description.ru-RU": "На основе ролей, ресурсов и действий система контроля доступа может точно управлять разрешениями на изменение интерфейса, работу с данными, доступ к меню и разрешениями для подключаемых модулей.",
|
|
8
8
|
"description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
|
|
9
|
-
"version": "2.1.0-alpha.
|
|
9
|
+
"version": "2.1.0-alpha.23",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"homepage": "https://docs.nocobase.com/handbook/acl",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
47
47
|
"directory": "packages/plugins/acl"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "baa19dafe25e85b680b2fea7451f202831930c1c"
|
|
50
50
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_acl=self.webpackChunk_nocobase_plugin_acl||[]).push([["139"],{870:function(e,n,t){t.r(n),t.d(n,{default:function(){return u}});var o=t(452),r=t(230),c=t(694),l=t(155),a=t.n(l),i=(0,r.createSchemaField)();function u(){var e=(0,c.useFlowEngineContext)().app,n=a().useMemo(function(){return(0,o.createForm)()},[]);return a().createElement("div",null,a().createElement("div",null,"Flow Settings Component Loader Demo Route"),a().createElement(r.FormProvider,{form:n},a().createElement(i,{schema:{type:"object",properties:{demo:{type:"void","x-component":"DemoFlowSettingsLazyField"}}},components:e.flowEngine.flowSettings.components})))}}}]);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_acl=self.webpackChunk_nocobase_plugin_acl||[]).push([["366"],{173:function(e,t,n){n.r(t),n.d(t,{default:function(){return a}});var o=n(155),u=n.n(o),r=n(59),l=n(694);function a(){var e=(0,l.useFlowContext)();return u().createElement(u().Fragment,null,u().createElement("div",null,"Demo Homepage Route",u().createElement(r.Button,{onClick:function(){return e.router.navigate("app-info")}},"Go to demo route")),u().createElement("div",null,"Demo flow settings page",u().createElement(r.Button,{onClick:function(){return e.router.navigate("flow-settings-component-loader")}},"Go to demo route")))}}}]);
|