@nocobase/plugin-acl 1.2.13-alpha → 1.3.0-alpha.20240710084543

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.
Files changed (67) hide show
  1. package/package.json +2 -2
  2. package/dist/client/NewRole.d.ts +0 -10
  3. package/dist/client/RolesManagement.d.ts +0 -10
  4. package/dist/client/RolesManagerProvider.d.ts +0 -13
  5. package/dist/client/RolesMenu.d.ts +0 -15
  6. package/dist/client/hooks/load-more-observer.d.ts +0 -15
  7. package/dist/client/index.d.ts +0 -16
  8. package/dist/client/index.js +0 -18
  9. package/dist/client/locale.d.ts +0 -9
  10. package/dist/client/permissions/ActionPermissions.d.ts +0 -12
  11. package/dist/client/permissions/AvailableActions.d.ts +0 -11
  12. package/dist/client/permissions/GeneralPermissions.d.ts +0 -12
  13. package/dist/client/permissions/MenuItemsProvider.d.ts +0 -12
  14. package/dist/client/permissions/MenuPermissions.d.ts +0 -12
  15. package/dist/client/permissions/Permissions.d.ts +0 -12
  16. package/dist/client/permissions/PluginPermissions.d.ts +0 -12
  17. package/dist/client/permissions/RolesResourcesActions.d.ts +0 -11
  18. package/dist/client/permissions/ScopeSelect.d.ts +0 -11
  19. package/dist/client/permissions/StrategyActions.d.ts +0 -10
  20. package/dist/client/permissions/style.d.ts +0 -9
  21. package/dist/client/roles-manager.d.ts +0 -18
  22. package/dist/client/schemas/roles.d.ts +0 -63
  23. package/dist/client/schemas/scopes.d.ts +0 -75
  24. package/dist/externalVersion.js +0 -31
  25. package/dist/index.d.ts +0 -10
  26. package/dist/index.js +0 -48
  27. package/dist/locale/en-US.json +0 -6
  28. package/dist/locale/ko_KR.json +0 -4
  29. package/dist/locale/zh-CN.json +0 -11
  30. package/dist/server/actions/available-actions.d.ts +0 -15
  31. package/dist/server/actions/available-actions.js +0 -51
  32. package/dist/server/actions/role-check.d.ts +0 -9
  33. package/dist/server/actions/role-check.js +0 -76
  34. package/dist/server/actions/role-collections.d.ts +0 -15
  35. package/dist/server/actions/role-collections.js +0 -84
  36. package/dist/server/actions/user-setDefaultRole.d.ts +0 -10
  37. package/dist/server/actions/user-setDefaultRole.js +0 -74
  38. package/dist/server/collections/roles-users.d.ts +0 -10
  39. package/dist/server/collections/roles-users.js +0 -39
  40. package/dist/server/collections/roles.d.ts +0 -10
  41. package/dist/server/collections/roles.js +0 -128
  42. package/dist/server/collections/rolesResources.d.ts +0 -10
  43. package/dist/server/collections/rolesResources.js +0 -64
  44. package/dist/server/collections/rolesResourcesActions.d.ts +0 -10
  45. package/dist/server/collections/rolesResourcesActions.js +0 -60
  46. package/dist/server/collections/rolesResourcesScopes.d.ts +0 -10
  47. package/dist/server/collections/rolesResourcesScopes.js +0 -54
  48. package/dist/server/collections/users.d.ts +0 -14
  49. package/dist/server/collections/users.js +0 -61
  50. package/dist/server/index.d.ts +0 -13
  51. package/dist/server/index.js +0 -56
  52. package/dist/server/middlewares/setCurrentRole.d.ts +0 -10
  53. package/dist/server/middlewares/setCurrentRole.js +0 -86
  54. package/dist/server/middlewares/with-acl-meta.d.ts +0 -10
  55. package/dist/server/middlewares/with-acl-meta.js +0 -255
  56. package/dist/server/migrations/20221214072638-set-role-snippets.d.ts +0 -14
  57. package/dist/server/migrations/20221214072638-set-role-snippets.js +0 -53
  58. package/dist/server/model/RoleModel.d.ts +0 -16
  59. package/dist/server/model/RoleModel.js +0 -55
  60. package/dist/server/model/RoleResourceActionModel.d.ts +0 -17
  61. package/dist/server/model/RoleResourceActionModel.js +0 -53
  62. package/dist/server/model/RoleResourceModel.d.ts +0 -20
  63. package/dist/server/model/RoleResourceModel.js +0 -72
  64. package/dist/server/server.d.ts +0 -24
  65. package/dist/server/server.js +0 -552
  66. package/dist/swagger/index.d.ts +0 -374
  67. package/dist/swagger/index.js +0 -404
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "权限控制",
5
5
  "description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.",
6
6
  "description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。",
7
- "version": "1.2.13-alpha",
7
+ "version": "1.3.0-alpha.20240710084543",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/acl",
@@ -34,5 +34,5 @@
34
34
  "url": "git+https://github.com/nocobase/nocobase.git",
35
35
  "directory": "packages/plugins/acl"
36
36
  },
37
- "gitHead": "b6a1c2ee330b47c2581ea2ce15ee46210e6220f2"
37
+ "gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4"
38
38
  }
@@ -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
- import React from 'react';
10
- export declare const NewRole: React.FC;
@@ -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
- import React from 'react';
10
- export declare const RolesManagement: React.FC;
@@ -1,13 +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
- /// <reference types="react" />
10
- export declare const RolesManagerContext: import("react").Context<{
11
- role: any;
12
- setRole: (role: any) => void;
13
- }>;
@@ -1,15 +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
- import React from 'react';
10
- export declare const RolesMenu: React.FC & {
11
- Item: React.FC<{
12
- item: any;
13
- onEdit: () => void;
14
- }>;
15
- };
@@ -1,15 +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
- import React from 'react';
10
- export declare const useLoadMoreObserver: ({ loadMore, }: {
11
- loadMore: () => void;
12
- }) => {
13
- lastItem: React.RefObject<any>;
14
- setLastItem: React.Dispatch<React.SetStateAction<React.RefObject<any>>>;
15
- };
@@ -1,16 +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
- import { Plugin } from '@nocobase/client';
10
- import { RolesManager } from './roles-manager';
11
- export declare class PluginACLClient extends Plugin {
12
- rolesManager: RolesManager;
13
- load(): Promise<void>;
14
- }
15
- export { RolesManagerContext } from './RolesManagerProvider';
16
- export default PluginACLClient;
@@ -1,18 +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
- (function(v,c){typeof exports=="object"&&typeof module!="undefined"?c(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("react"),require("antd"),require("@formily/react"),require("@ant-design/icons"),require("react-i18next"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("ahooks"),require("lodash"),require("antd-style")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","react","antd","@formily/react","@ant-design/icons","react-i18next","@formily/shared","@nocobase/utils/client","@formily/core","ahooks","lodash","antd-style"],c):(v=typeof globalThis!="undefined"?globalThis:v||self,c(v["@nocobase/plugin-acl"]={},v["@nocobase/client"],v.jsxRuntime,v.react,v.antd,v["@formily/react"],v["@ant-design/icons"],v["react-i18next"],v["@formily/shared"],v["@nocobase/utils"],v["@formily/core"],v.ahooks,v.lodash,v["antd-style"]))})(this,function(v,c,a,h,p,E,U,T,x,j,K,ge,ee,tt){"use strict";var Ii=Object.defineProperty,Ti=Object.defineProperties;var Oi=Object.getOwnPropertyDescriptors;var et=Object.getOwnPropertySymbols;var Mi=Object.prototype.hasOwnProperty,Fi=Object.prototype.propertyIsEnumerable;var fe=(v,c,a)=>c in v?Ii(v,c,{enumerable:!0,configurable:!0,writable:!0,value:a}):v[c]=a,P=(v,c)=>{for(var a in c||(c={}))Mi.call(c,a)&&fe(v,a,c[a]);if(et)for(var a of et(c))Fi.call(c,a)&&fe(v,a,c[a]);return v},D=(v,c)=>Ti(v,Oi(c));var ve=(v,c,a)=>(fe(v,typeof c!="symbol"?c+"":c,a),a);var w=(v,c,a)=>new Promise((h,p)=>{var E=x=>{try{T(a.next(x))}catch(j){p(j)}},U=x=>{try{T(a.throw(x))}catch(j){p(j)}},T=x=>x.done?h(x.value):Promise.resolve(x.value).then(E,U);T((a=a.apply(v,c)).next())});function N(){return T.useTranslation(["@nocobase/plugin-acl","client"],{nsMode:"fallback"})}const F=h.createContext({role:null});F.displayName="RolesManagerContext";var L=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nt=Array.isArray,G=nt,rt=typeof L=="object"&&L&&L.Object===Object&&L,st=rt,at=st,ot=typeof self=="object"&&self&&self.Object===Object&&self,it=at||ot||Function("return this")(),V=it,ct=V,lt=ct.Symbol,W=lt,ye=W,_e=Object.prototype,ut=_e.hasOwnProperty,pt=_e.toString,z=ye?ye.toStringTag:void 0;function dt(e){var t=ut.call(e,z),n=e[z];try{e[z]=void 0;var r=!0}catch(i){}var s=pt.call(e);return r&&(t?e[z]=n:delete e[z]),s}var ht=dt,ft=Object.prototype,vt=ft.toString;function gt(e){return vt.call(e)}var mt=gt,be=W,yt=ht,_t=mt,bt="[object Null]",Ct="[object Undefined]",Ce=be?be.toStringTag:void 0;function $t(e){return e==null?e===void 0?Ct:bt:Ce&&Ce in Object(e)?yt(e):_t(e)}var te=$t;function xt(e){return e!=null&&typeof e=="object"}var ne=xt,St=te,wt=ne,At="[object Symbol]";function Pt(e){return typeof e=="symbol"||wt(e)&&St(e)==At}var re=Pt,It=G,Tt=re,Ot=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mt=/^\w*$/;function Ft(e,t){if(It(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Tt(e)?!0:Mt.test(e)||!Ot.test(e)||t!=null&&e in Object(t)}var Et=Ft;function Dt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var se=Dt,Nt=te,kt=se,qt="[object AsyncFunction]",Ht="[object Function]",jt="[object GeneratorFunction]",Gt="[object Proxy]";function zt(e){if(!kt(e))return!1;var t=Nt(e);return t==Ht||t==jt||t==qt||t==Gt}var Ut=zt,Kt=V,Lt=Kt["__core-js_shared__"],Vt=Lt,ae=Vt,$e=function(){var e=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Wt(e){return!!$e&&$e in e}var Bt=Wt,Yt=Function.prototype,Xt=Yt.toString;function Jt(e){if(e!=null){try{return Xt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Zt=Jt,Qt=Ut,Rt=Bt,en=se,tn=Zt,nn=/[\\^$.*+?()[\]{}|]/g,rn=/^\[object .+?Constructor\]$/,sn=Function.prototype,an=Object.prototype,on=sn.toString,cn=an.hasOwnProperty,ln=RegExp("^"+on.call(cn).replace(nn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function un(e){if(!en(e)||Rt(e))return!1;var t=Qt(e)?ln:rn;return t.test(tn(e))}var pn=un;function dn(e,t){return e==null?void 0:e[t]}var hn=dn,fn=pn,vn=hn;function gn(e,t){var n=vn(e,t);return fn(n)?n:void 0}var B=gn,mn=B,yn=mn(Object,"create"),Y=yn,xe=Y;function _n(){this.__data__=xe?xe(null):{},this.size=0}var bn=_n;function Cn(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var $n=Cn,xn=Y,Sn="__lodash_hash_undefined__",wn=Object.prototype,An=wn.hasOwnProperty;function Pn(e){var t=this.__data__;if(xn){var n=t[e];return n===Sn?void 0:n}return An.call(t,e)?t[e]:void 0}var In=Pn,Tn=Y,On=Object.prototype,Mn=On.hasOwnProperty;function Fn(e){var t=this.__data__;return Tn?t[e]!==void 0:Mn.call(t,e)}var En=Fn,Dn=Y,Nn="__lodash_hash_undefined__";function kn(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Dn&&t===void 0?Nn:t,this}var qn=kn,Hn=bn,jn=$n,Gn=In,zn=En,Un=qn;function k(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}k.prototype.clear=Hn,k.prototype.delete=jn,k.prototype.get=Gn,k.prototype.has=zn,k.prototype.set=Un;var Kn=k;function Ln(){this.__data__=[],this.size=0}var Vn=Ln;function Wn(e,t){return e===t||e!==e&&t!==t}var Se=Wn,Bn=Se;function Yn(e,t){for(var n=e.length;n--;)if(Bn(e[n][0],t))return n;return-1}var X=Yn,Xn=X,Jn=Array.prototype,Zn=Jn.splice;function Qn(e){var t=this.__data__,n=Xn(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Zn.call(t,n,1),--this.size,!0}var Rn=Qn,er=X;function tr(e){var t=this.__data__,n=er(t,e);return n<0?void 0:t[n][1]}var nr=tr,rr=X;function sr(e){return rr(this.__data__,e)>-1}var ar=sr,or=X;function ir(e,t){var n=this.__data__,r=or(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var cr=ir,lr=Vn,ur=Rn,pr=nr,dr=ar,hr=cr;function q(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}q.prototype.clear=lr,q.prototype.delete=ur,q.prototype.get=pr,q.prototype.has=dr,q.prototype.set=hr;var fr=q,vr=B,gr=V,mr=vr(gr,"Map"),yr=mr,we=Kn,_r=fr,br=yr;function Cr(){this.size=0,this.__data__={hash:new we,map:new(br||_r),string:new we}}var $r=Cr;function xr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Sr=xr,wr=Sr;function Ar(e,t){var n=e.__data__;return wr(t)?n[typeof t=="string"?"string":"hash"]:n.map}var J=Ar,Pr=J;function Ir(e){var t=Pr(this,e).delete(e);return this.size-=t?1:0,t}var Tr=Ir,Or=J;function Mr(e){return Or(this,e).get(e)}var Fr=Mr,Er=J;function Dr(e){return Er(this,e).has(e)}var Nr=Dr,kr=J;function qr(e,t){var n=kr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var Hr=qr,jr=$r,Gr=Tr,zr=Fr,Ur=Nr,Kr=Hr;function H(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}H.prototype.clear=jr,H.prototype.delete=Gr,H.prototype.get=zr,H.prototype.has=Ur,H.prototype.set=Kr;var Ae=H,Pe=Ae,Lr="Expected a function";function oe(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Lr);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(oe.Cache||Pe),n}oe.Cache=Pe;var Vr=oe,Wr=Vr,Br=500;function Yr(e){var t=Wr(e,function(r){return n.size===Br&&n.clear(),r}),n=t.cache;return t}var Xr=Yr,Jr=Xr,Zr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qr=/\\(\\)?/g,Rr=Jr(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Zr,function(n,r,s,i){t.push(s?i.replace(Qr,"$1"):r||n)}),t}),es=Rr;function ts(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var ns=ts,Ie=W,rs=ns,ss=G,as=re,os=1/0,Te=Ie?Ie.prototype:void 0,Oe=Te?Te.toString:void 0;function Me(e){if(typeof e=="string")return e;if(ss(e))return rs(e,Me)+"";if(as(e))return Oe?Oe.call(e):"";var t=e+"";return t=="0"&&1/e==-os?"-0":t}var is=Me,cs=is;function ls(e){return e==null?"":cs(e)}var us=ls,ps=G,ds=Et,hs=es,fs=us;function vs(e,t){return ps(e)?e:ds(e,t)?[e]:hs(fs(e))}var Z=vs,gs=re,ms=1/0;function ys(e){if(typeof e=="string"||gs(e))return e;var t=e+"";return t=="0"&&1/e==-ms?"-0":t}var ie=ys,_s=Z,bs=ie;function Cs(e,t){t=_s(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[bs(t[n++])];return n&&n==r?e:void 0}var $s=Cs,xs=B,Ss=function(){try{var e=xs(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Fe=Ss,Ee=Fe;function ws(e,t,n){t=="__proto__"&&Ee?Ee(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var As=ws,Ps=As,Is=Se,Ts=Object.prototype,Os=Ts.hasOwnProperty;function Ms(e,t,n){var r=e[t];(!(Os.call(e,t)&&Is(r,n))||n===void 0&&!(t in e))&&Ps(e,t,n)}var Fs=Ms,Es=9007199254740991,Ds=/^(?:0|[1-9]\d*)$/;function Ns(e,t){var n=typeof e;return t=t==null?Es:t,!!t&&(n=="number"||n!="symbol"&&Ds.test(e))&&e>-1&&e%1==0&&e<t}var De=Ns,ks=Fs,qs=Z,Hs=De,Ne=se,js=ie;function Gs(e,t,n,r){if(!Ne(e))return e;t=qs(t,e);for(var s=-1,i=t.length,o=i-1,l=e;l!=null&&++s<i;){var u=js(t[s]),d=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(s!=o){var y=l[u];d=r?r(y,u,l):void 0,d===void 0&&(d=Ne(y)?y:Hs(t[s+1])?[]:{})}ks(l,u,d),l=l[u]}return e}var zs=Gs,Us=$s,Ks=zs,Ls=Z;function Vs(e,t,n){for(var r=-1,s=t.length,i={};++r<s;){var o=t[r],l=Us(e,o);n(l,o)&&Ks(i,Ls(o,e),l)}return i}var Ws=Vs;function Bs(e,t){return e!=null&&t in Object(e)}var Ys=Bs,Xs=te,Js=ne,Zs="[object Arguments]";function Qs(e){return Js(e)&&Xs(e)==Zs}var Rs=Qs,ke=Rs,ea=ne,qe=Object.prototype,ta=qe.hasOwnProperty,na=qe.propertyIsEnumerable,ra=ke(function(){return arguments}())?ke:function(e){return ea(e)&&ta.call(e,"callee")&&!na.call(e,"callee")},He=ra,sa=9007199254740991;function aa(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=sa}var oa=aa,ia=Z,ca=He,la=G,ua=De,pa=oa,da=ie;function ha(e,t,n){t=ia(t,e);for(var r=-1,s=t.length,i=!1;++r<s;){var o=da(t[r]);if(!(i=e!=null&&n(e,o)))break;e=e[o]}return i||++r!=s?i:(s=e==null?0:e.length,!!s&&pa(s)&&ua(o,s)&&(la(e)||ca(e)))}var fa=ha,va=Ys,ga=fa;function ma(e,t){return e!=null&&ga(e,t,va)}var ya=ma,_a=Ws,ba=ya;function Ca(e,t){return _a(e,t,function(n,r){return ba(e,r)})}var $a=Ca;function xa(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}var Sa=xa,je=W,wa=He,Aa=G,Ge=je?je.isConcatSpreadable:void 0;function Pa(e){return Aa(e)||wa(e)||!!(Ge&&e&&e[Ge])}var Ia=Pa,Ta=Sa,Oa=Ia;function ze(e,t,n,r,s){var i=-1,o=e.length;for(n||(n=Oa),s||(s=[]);++i<o;){var l=e[i];t>0&&n(l)?t>1?ze(l,t-1,n,r,s):Ta(s,l):r||(s[s.length]=l)}return s}var Ma=ze,Fa=Ma;function Ea(e){var t=e==null?0:e.length;return t?Fa(e,1):[]}var Da=Ea;function Na(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var ka=Na,qa=ka,Ue=Math.max;function Ha(e,t,n){return t=Ue(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Ue(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var l=Array(t+1);++s<t;)l[s]=r[s];return l[t]=n(o),qa(e,this,l)}}var ja=Ha;function Ga(e){return function(){return e}}var za=Ga;function Ua(e){return e}var Ka=Ua,La=za,Ke=Fe,Va=Ka,Wa=Ke?function(e,t){return Ke(e,"toString",{configurable:!0,enumerable:!1,value:La(t),writable:!0})}:Va,Ba=Wa,Ya=800,Xa=16,Ja=Date.now;function Za(e){var t=0,n=0;return function(){var r=Ja(),s=Xa-(r-n);if(n=r,s>0){if(++t>=Ya)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Qa=Za,Ra=Ba,eo=Qa,to=eo(Ra),no=to,ro=Da,so=ja,ao=no;function oo(e){return ao(so(e,void 0,ro),e+"")}var io=oo,co=$a,lo=io,uo=lo(function(e,t){return e==null?{}:co(e,t)}),po=uo;const ho=me(po),fo={type:"object",properties:{[x.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:e=>{const t=c.useRecord(),n=c.useRequest(()=>Promise.resolve({data:ho(t,["title","name","default"])}),D(P({},e),{manual:!0})),r=c.useActionContext();return h.useEffect(()=>{r.visible&&n.run()},[r.visible]),n}},title:'{{t("Edit role")}}',properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},default:{title:"","x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default role")}}',"x-reactions":e=>{e.initialValue?e.disabled=!0:e.disabled=!1}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},vo=({loadMore:e})=>{const[t,n]=h.useState(null),r=h.useRef(null),s=h.useCallback(i=>{i&&(r.current&&r.current.disconnect(),r.current=new IntersectionObserver(o=>{o.forEach(l=>{l.target===i.current&&l.isIntersecting&&(r.current&&r.current.unobserve(i.current),e())})}),i.current&&r.current&&r.current.observe(i.current))},[e]);return h.useEffect(()=>(s(t),()=>{r.current&&r.current.disconnect()}),[t,s]),{lastItem:t,setLastItem:n}},Q=()=>{const{t:e}=N(),{data:t,mutate:n}=c.useResourceActionContext(),[r,s]=h.useState(!1),[i,o]=h.useState(null),{role:l,setRole:u}=h.useContext(F),[d,y]=h.useState([]),[C,b]=h.useState(!1),S=c.useAPIClient(),A=h.useCallback(()=>w(this,null,function*(){const f=t==null?void 0:t.meta;if(!f||f.page>=f.totalPage)return;b(!0);const _=yield S.resource("roles").list({page:f.page+1,pageSize:f.pageSize,filter:{"name.$ne":"root"},showAnonymous:!0,sort:["createdAt"],appends:[]});n((_==null?void 0:_.data)||{}),b(!1)}),[t]),{lastItem:$,setLastItem:I}=vo({loadMore:A}),g=({key:f})=>{u(d.find(_=>_.name===f))};h.useEffect(()=>{d[0]&&u(d[0])},[d,u]),h.useEffect(()=>{var _,O;if(!((_=t==null?void 0:t.data)!=null&&_.length))return;const f=h.createRef();I(f),((O=t.meta)==null?void 0:O.page)>1?y(M=>M.concat(t.data)):y(t.data)},[t,I]);const m=h.useMemo(()=>d.map((f,_)=>({key:f.name,label:_===d.length-1?a.jsx("div",{ref:$,children:a.jsx(Q.Item,{item:f,onEdit:()=>{s(!0),o(f)}})}):a.jsx(Q.Item,{item:f,onEdit:()=>{s(!0),o(f)}})})),[d,$]);return a.jsxs(a.Fragment,{children:[d.length?a.jsx(p.Menu,{style:{border:"none",maxHeight:"65vh",overflowY:"auto"},items:[...m,...C?[{key:"loading",label:a.jsx(p.Spin,{})}]:[]],selectedKeys:[l==null?void 0:l.name],onSelect:g}):a.jsx(p.Empty,{image:p.Empty.PRESENTED_IMAGE_SIMPLE}),a.jsx(c.ActionContextProvider,{value:{visible:r,setVisible:s},children:a.jsx(c.RecordProvider,{record:i,collectionName:"departments",children:a.jsx(c.SchemaComponent,{scope:{t:e},schema:fo})})})]})};Q.Item=function({item:t,onEdit:n}){const{t:r}=N(),{refreshAsync:s}=c.useResourceActionContext(),{modal:i,message:o}=p.App.useApp(),l=c.useAPIClient(),u=()=>{i.confirm({title:r("Delete"),content:r("Are you sure you want to delete it?"),onOk:()=>w(this,null,function*(){yield l.resource("roles").destroy({filterByTk:t.name}),o.success(r("Deleted successfully")),yield s()})})},d=({key:C,domEvent:b})=>{switch(b.stopPropagation(),C){case"edit":n();break;case"delete":u()}},y=E.Schema.compile(t.title,{t:r});return a.jsxs(p.Row,{children:[a.jsx(p.Col,{flex:3,style:{display:"inline-flex",alignItems:"center"},children:a.jsxs("span",{style:{whiteSpace:"nowrap",width:"120px",overflow:"hidden",textOverflow:"ellipsis"},children:[a.jsx(U.TagOutlined,{}),a.jsx("span",{style:{marginLeft:"10px"},title:y,children:y})]})}),a.jsxs(p.Col,{children:[t.default?a.jsx(p.Tag,{color:"success",bordered:!1,children:r("Default")}):null,a.jsx(p.Dropdown,{menu:{items:[{label:r("Edit"),key:"edit"},{label:r("Delete"),key:"delete"}],onClick:d},children:a.jsx(U.MoreOutlined,{})})]})]})};const ce=h.createContext([]);ce.displayName="AvailableActionsContext";const go=e=>{const{data:t,loading:n}=c.useRequest({resource:"availableActions",action:"list"});return n?a.jsx(p.Spin,{}):a.jsx(ce.Provider,{value:t==null?void 0:t.data,children:e.children})},mo=()=>h.useContext(ce);var yo="__lodash_hash_undefined__";function _o(e){return this.__data__.set(e,yo),this}var bo=_o;function Co(e){return this.__data__.has(e)}var $o=Co,xo=Ae,So=bo,wo=$o;function R(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new xo;++t<n;)this.add(e[t])}R.prototype.add=R.prototype.push=So,R.prototype.has=wo;var Ao=R;function Po(e,t,n,r){for(var s=e.length,i=n+(r?1:-1);r?i--:++i<s;)if(t(e[i],i,e))return i;return-1}var Io=Po;function To(e){return e!==e}var Oo=To;function Mo(e,t,n){for(var r=n-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}var Fo=Mo,Eo=Io,Do=Oo,No=Fo;function ko(e,t,n){return t===t?No(e,t,n):Eo(e,Do,n)}var qo=ko,Ho=qo;function jo(e,t){var n=e==null?0:e.length;return!!n&&Ho(e,t,0)>-1}var Go=jo;function zo(e,t,n){for(var r=-1,s=e==null?0:e.length;++r<s;)if(n(t,e[r]))return!0;return!1}var Uo=zo;function Ko(e,t){return e.has(t)}var Lo=Ko,Vo=B,Wo=V,Bo=Vo(Wo,"Set"),Yo=Bo;function Xo(){}var Jo=Xo;function Zo(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var Le=Zo,le=Yo,Qo=Jo,Ro=Le,ei=1/0,ti=le&&1/Ro(new le([,-0]))[1]==ei?function(e){return new le(e)}:Qo,ni=ti,ri=Ao,si=Go,ai=Uo,oi=Lo,ii=ni,ci=Le,li=200;function ui(e,t,n){var r=-1,s=si,i=e.length,o=!0,l=[],u=l;if(n)o=!1,s=ai;else if(i>=li){var d=t?null:ii(e);if(d)return ci(d);o=!1,s=oi,u=new ri}else u=t?[]:l;e:for(;++r<i;){var y=e[r],C=t?t(y):y;if(y=n||y!==0?y:0,o&&C===C){for(var b=u.length;b--;)if(u[b]===C)continue e;t&&u.push(C),l.push(y)}else s(u,C,n)||(u!==l&&u.push(C),l.push(y))}return l}var pi=ui,di=pi;function hi(e){return e&&e.length?di(e):[]}var fi=hi;const vi=me(fi),gi=e=>{var n;if(!e)return{};const t={};return(n=e==null?void 0:e.forEach)==null||n.call(e,r=>{const[s,i]=r.split(":");t[s]=i||"all"}),t},Ve=e=>{const t=[];for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=e[n];r==="all"?t.push(n):t.push(`${n}:${r}`)}return t},mi=E.connect(e=>{const{onChange:t}=e,n=mo(),r=c.useCompile(),{t:s}=T.useTranslation(),i=E.useField(),o=gi(i.value);return a.jsx("div",{children:a.jsx(p.Table,{rowKey:"name",size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:s("Action display name"),render:l=>r(l)},{dataIndex:"onNewRecord",title:s("Action type"),render:l=>l?a.jsx(p.Tag,{color:"green",children:s("Action on new records")}):a.jsx(p.Tag,{color:"geekblue",children:s("Action on existing records")})},{dataIndex:"enabled",title:s("Allow"),render:(l,u)=>a.jsx(p.Checkbox,{checked:l,"aria-label":`${u.name}_checkbox`,onChange:d=>{l?delete o[u.name]:o[u.name]="all",t(Ve(o))}})},{dataIndex:"scope",title:s("Data scope"),render:(l,u)=>!u.onNewRecord&&a.jsx(p.Select,{"data-testid":"select-data-scope",popupMatchSelectWidth:!1,size:"small",value:l,options:[{label:s("All records"),value:"all"},{label:s("Own records"),value:"own"}],onChange:d=>{o[u.name]=d,t(Ve(o))}})}],dataSource:n==null?void 0:n.map(l=>{let u="all",d=!1;return o[l.name]&&(d=!0,u=o[l.name]),D(P({},l),{enabled:d,scope:u})})})})}),We=tt.createStyles(({css:e})=>e`
11
- .ant-table-cell {
12
- > .ant-space-horizontal {
13
- .ant-space-item-split:has(+ .ant-space-item:empty) {
14
- display: none;
15
- }
16
- }
17
- }
18
- `),Be=(e=[],t=[])=>{for(const n of e)t.push(n.aclSnippet),n.children&&n.children.length&&Be(n.children,t);return t},yi=({active:e})=>{const t=c.useApp(),{styles:n}=We(),{role:r}=h.useContext(F),s=c.useAPIClient(),i=c.useCompile(),o=t.pluginSettingsManager.getList(!1),l=t.pluginSettingsManager.getAclSnippets(),[u,d]=h.useState((r==null?void 0:r.snippets)||[]),y=h.useMemo(()=>ee.flatMap(o,g=>g.children?[g,...g.children]:g),[o]),C=h.useMemo(()=>u.includes("pm.*")&&u.every(g=>!g.startsWith("!pm.")),[u]),{t:b}=T.useTranslation(),{loading:S,refresh:A}=c.useRequest({resource:"roles.snippets",resourceOf:r==null?void 0:r.name,action:"list",params:{paginate:!1}},{ready:!!r&&e,refreshDeps:[r==null?void 0:r.name],manual:!0,onSuccess(g){d((g==null?void 0:g.data.filter(m=>y.find(f=>m.includes(`!${f.aclSnippet}`)||!m.startsWith("!pm."))))||[])}});if(!r)return;const $=s.resource("roles.snippets",r==null?void 0:r.name),I=(g,m)=>w(this,null,function*(){const _=Be(m==null?void 0:m.children,[]).concat(m.aclSnippet);g?(yield $.add({values:_.map(O=>"!"+O)}),A()):(yield $.remove({values:_.map(O=>"!"+O)}),A()),p.message.success(b("Saved successfully"))});return a.jsx(p.Table,{className:n,loading:S,rowKey:"key",pagination:!1,expandable:{defaultExpandAllRows:!0},columns:[{dataIndex:"title",title:b("Plugin name"),render:g=>i(g)},{dataIndex:"accessible",title:a.jsxs(a.Fragment,{children:[a.jsx(p.Checkbox,{checked:C,onChange:()=>w(this,null,function*(){const g=l.map(m=>"!"+m);C?yield $.add({values:g}):yield $.remove({values:g}),A(),p.message.success(b("Saved successfully"))})}),b("Accessible")]}),render:(g,m)=>{const f=!u.includes("!"+m.aclSnippet);return a.jsx(p.Checkbox,{checked:f,onChange:()=>I(f,m)})}}],dataSource:o.filter(g=>g.isTopLevel!==!1).map(g=>g.showTabs!==!1?g:ee.omit(g,"children"))})},_i=E.connect(e=>{const{t}=T.useTranslation();return a.jsxs(p.Checkbox.Group,{style:{width:"100%",display:"block"},value:e.value,onChange:n=>{const r=["ui.*","pm","pm.*","app"],s=r.map(o=>`!${o}`),i=vi([...e.value||[],...n]).filter(o=>o&&!s.includes(o)).map(o=>!r.includes(o)||n!=null&&n.includes(o)?o:`!${o}`);for(const o of r)!i.includes(o)&&!i.includes(`!${o}`)&&i.push(`!${o}`);e.onChange(i)},children:[a.jsx("div",{style:{marginTop:16},children:a.jsx(p.Checkbox,{value:"ui.*",children:t("Allows to configure interface")})}),a.jsx("div",{style:{marginTop:8},children:a.jsx(p.Checkbox,{value:"pm",children:t("Allows to install, activate, disable plugins")})}),a.jsx("div",{style:{marginTop:8},children:a.jsx(p.Checkbox,{value:"pm.*",children:t("Allows to configure plugins")})}),a.jsx("div",{style:{marginTop:8},children:a.jsx(p.Checkbox,{value:"app",children:t("Allows to clear cache, reboot application")})})]})}),bi=({active:e})=>{var u;const{role:t,setRole:n}=h.useContext(F),{t:r}=N(),s=c.useAPIClient(),i=(u=t==null?void 0:t.snippets)==null?void 0:u.includes("pm.*"),o=ge.useMemoizedFn(d=>w(this,null,function*(){yield s.resource("roles").update({filterByTk:t.name,values:{snippets:d.values.snippets}}),n(P(P({},t),d.values)),p.message.success(r("Saved successfully"))})),l=h.useMemo(()=>K.createForm({values:t,effects(){K.onFormValuesChange(d=>w(this,null,function*(){yield o(d)}))}}),[t,o]);return a.jsx(c.SchemaComponent,{components:{SnippetCheckboxGroup:_i,StrategyActions:mi,PluginPermissions:yi},scope:{pm:i},schema:{type:"void",name:x.uid(),"x-component":"div",properties:{general:{"x-component":"FormV2","x-component-props":{form:l},properties:{snippets:{title:r("Configure permissions"),type:"boolean","x-decorator":"FormItem","x-component":"SnippetCheckboxGroup"}}},plugins:{"x-component":"FormV2",properties:{pluginSettings:{title:r("Plugin settings"),"x-decorator":"FormItem","x-component":"PluginPermissions","x-visible":"{{pm}}"}}}}}})},ue=h.createContext(null);ue.displayName="MenuItemsContext";const Ye=(e={})=>{const t=[];for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const r=e[n],s={title:r.title,uid:r["x-uid"]};r.properties&&(s.children=Ye(r.properties)),t.push(s)}return t},Ci=()=>h.useContext(ue),Xe=e=>{var i,o;const n={url:`uiSchemas:getProperties/${c.useAdminSchemaUid()}`},r=c.useRequest(n);if(r.loading)return a.jsx(p.Spin,{});const s=Ye((o=(i=r.data)==null?void 0:i.data)==null?void 0:o.properties);return a.jsx(ue.Provider,{value:{service:r,items:s},children:e.children})},Je=e=>{if(!Array.isArray(e))return[];const t=[];for(const n of e)t.push(n.uid),t.push(...Je(n.children));return t},Ze=(e,t,n=[])=>{if(!e)return[];for(const r of e){if(n.push(r.uid),t(r))return n;if(r.children){const s=Ze(r.children,t,n);if(s.length)return s}n.pop()}return[]},Qe=(e=[],t=[])=>{for(const n of e)t.push(n.uid),n.children&&n.children.length&&Qe(n.children,t);return t},$i=({active:e})=>{const{styles:t}=We(),{role:n,setRole:r}=h.useContext(F),s=c.useAPIClient(),{items:i}=Ci(),{t:o}=T.useTranslation(),l=Je(i),[u,d]=h.useState([]),{loading:y,refresh:C}=c.useRequest({resource:"roles.menuUiSchemas",resourceOf:n.name,action:"list",params:{paginate:!1}},{ready:!!n&&e,refreshDeps:[n==null?void 0:n.name],onSuccess(m){var f;d(((f=m==null?void 0:m.data)==null?void 0:f.map(_=>_["x-uid"]))||[])}}),b=s.resource("roles.menuUiSchemas",n.name),S=l.length===u.length,A=(m,f)=>w(this,null,function*(){const _=Ze(i,M=>M.uid===f.uid),O=Qe(f==null?void 0:f.children,[]);if(m){const M=O.concat(f.uid),he=u.filter(Pi=>!M.includes(Pi));d([...he]),yield b.remove({values:M})}else{const M=O.concat(_);d(he=>ee.uniq([...he,...M])),yield b.add({values:M})}p.message.success(o("Saved successfully"))}),$=m=>m.map(f=>{const _=o(f.title);return f.children?D(P({},f),{title:_,children:$(f.children)}):D(P({},f),{title:_})}),I=ge.useMemoizedFn(m=>w(this,null,function*(){yield s.resource("roles").update({filterByTk:n.name,values:m.values}),r(P(P({},n),m.values)),p.message.success(o("Saved successfully"))})),g=h.useMemo(()=>K.createForm({values:n,effects(){K.onFormValuesChange(m=>w(this,null,function*(){yield I(m)}))}}),[n,I]);return a.jsxs(a.Fragment,{children:[a.jsx(c.SchemaComponent,{schema:{type:"void",name:x.uid(),"x-component":"FormV2","x-component-props":{form:g},properties:{allowNewMenu:{title:o("Menu permissions"),"x-decorator":"FormItem","x-component":"Checkbox","x-content":o("New menu items are allowed to be accessed by default.")}}}}),a.jsx(p.Table,{className:t,loading:y,rowKey:"uid",pagination:!1,expandable:{defaultExpandAllRows:!0},columns:[{dataIndex:"title",title:o("Menu item title")},{dataIndex:"accessible",title:a.jsxs(a.Fragment,{children:[a.jsx(p.Checkbox,{checked:S,onChange:m=>w(this,null,function*(){S?yield b.set({values:[]}):yield b.set({values:l}),C(),p.message.success(o("Saved successfully"))})})," ",o("Accessible")]}),render:(m,f)=>{const _=u.includes(f.uid);return a.jsx(p.Checkbox,{checked:_,onChange:()=>A(_,f)})}}],dataSource:$(i)})]})},pe=e=>a.jsx("div",{style:{maxHeight:"60vh",overflowY:"auto"},children:e.children}),xi=({active:e})=>{var b;const{t}=N(),[n,r]=h.useState("general"),{role:s,setRole:i}=h.useContext(F),o=(b=s==null?void 0:s.snippets)==null?void 0:b.includes("pm.*"),u=c.useApp().getComponent("DataSourcePermissionManager"),d=h.useMemo(()=>[{key:"general",label:t("System"),children:a.jsx(pe,{children:a.jsx(bi,{active:n==="general"&&e})})},{key:"menu",label:t("Menu"),children:a.jsx(pe,{children:a.jsx(Xe,{children:a.jsx($i,{active:n==="menu"&&e})})})},...u?[{key:"dataSource",label:t("Data sources"),children:a.jsx(pe,{children:a.jsx(Xe,{children:a.jsx(u,{role:s,active:n==="dataSource"&&e})})})}]:[]],[o,n,e,t]),y=c.useAPIClient(),{data:C}=c.useRequest(()=>y.resource("roles").get({filterByTk:s==null?void 0:s.name}).then(S=>{var $,I;const A=($=S==null?void 0:S.data)==null?void 0:$.data;return(I=A.snippets)==null||I.forEach(g=>{A[g]=!0}),A}),{ready:e&&!!s,refreshDeps:[s==null?void 0:s.name]});return h.useEffect(()=>{r("general")},[s==null?void 0:s.name]),h.useEffect(()=>{i(C)},[C]),a.jsx(go,{children:a.jsx(p.Tabs,{type:"card",activeKey:n,onChange:S=>r(S),items:d})})},Si=()=>{const{t:e}=N();return a.jsx(c.SchemaComponent,{scope:{t:e},schema:{type:"void",properties:{newRole:{type:"void",title:e("New role"),"x-component":"Action","x-component-props":{type:"text",icon:"PlusOutlined",style:{width:"100%",textAlign:"left"}},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(t){const n=c.useActionContext();return c.useRequest(()=>Promise.resolve({data:{name:`r_${x.uid()}`,snippets:["!ui.*","!pm","!pm.*"]}}),D(P({},t),{refreshDeps:[n.visible]}))}},title:e("New role"),properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'},default:{"x-component":"CollectionField","x-decorator":"FormItem",title:"","x-content":'{{t("Default role")}}'},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}}})},Re={name:"roles",filterTargetKey:"name",targetKey:"name",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Role display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Role UID")}}',type:"string","x-component":"Input"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{title:'{{t("Default role")}}',type:"boolean","x-component":"Checkbox"}}]},wi=()=>{const{t:e}=N(),t=c.usePlugin(de),[n,r]=h.useState("permissions"),s=Array.from(t.rolesManager.list()).map(([u,d])=>({key:u,label:E.Schema.compile(d.title,{t:e}),children:d.Component?h.createElement(d.Component,{active:n===u}):null})),[i,o]=h.useState(null),l=c.useSchemaComponentContext();return a.jsx(c.SchemaComponentContext.Provider,{value:D(P({},l),{designable:!1}),children:a.jsx(F.Provider,{value:{role:i,setRole:o},children:a.jsx(p.Card,{children:a.jsxs(p.Row,{gutter:24,style:{flexWrap:"nowrap"},children:[a.jsx(p.Col,{flex:"280px",style:{borderRight:"1px solid #eee",minWidth:"250px"},children:a.jsx(c.ResourceActionProvider,{collection:Re,request:{resource:"roles",action:"list",params:{filter:{"name.$ne":"root"},showAnonymous:!0,sort:["createdAt"],appends:[]}},children:a.jsxs(c.CollectionProvider_deprecated,{collection:Re,children:[a.jsx(p.Row,{children:a.jsx(Si,{})}),a.jsx(p.Divider,{style:{margin:"12px 0"}}),a.jsx(Q,{})]})})}),a.jsx(p.Col,{flex:"auto",style:{overflow:"hidden"},children:a.jsx(p.Tabs,{activeKey:n,onChange:u=>r(u),items:[{key:"permissions",label:e("Permissions"),children:a.jsx(xi,{active:n==="permissions"})},...s]})})]})})})})};class Ai{constructor(){ve(this,"rolesManager",new j.Registry)}add(t,n){this.rolesManager.register(t,n)}list(){return this.rolesManager.getEntities()}}class de extends c.Plugin{constructor(){super(...arguments);ve(this,"rolesManager",new Ai)}load(){return w(this,null,function*(){this.pluginSettingsManager.add("users-permissions.roles",{title:this.t("Roles & Permissions"),icon:"LockOutlined",Component:wi,aclSnippet:"pm.acl.roles",sort:3})})}}v.PluginACLClient=de,v.RolesManagerContext=F,v.default=de,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,9 +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
- export declare function useACLTranslation(): import("react-i18next").UseTranslationResponse<("@nocobase/plugin-acl" | "client")[], undefined>;
@@ -1,12 +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
- import React from 'react';
10
- export declare const ActionPermissions: React.FC<{
11
- active: boolean;
12
- }>;
@@ -1,11 +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
- import React from 'react';
10
- export declare const AvailableActionsProvider: React.FC;
11
- export declare const useAvailableActions: () => any[];
@@ -1,12 +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
- import React from 'react';
10
- export declare const GeneralPermissions: React.FC<{
11
- active: boolean;
12
- }>;
@@ -1,12 +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
- import React from 'react';
10
- export declare const toItems: (properties?: {}) => any[];
11
- export declare const useMenuItems: () => any;
12
- export declare const MenuItemsProvider: (props: any) => React.JSX.Element;
@@ -1,12 +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
- import React from 'react';
10
- export declare const MenuPermissions: React.FC<{
11
- active: boolean;
12
- }>;
@@ -1,12 +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
- import React from 'react';
10
- export declare const Permissions: React.FC<{
11
- active: boolean;
12
- }>;
@@ -1,12 +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
- import React from 'react';
10
- export declare const PluginPermissions: React.FC<{
11
- active: boolean;
12
- }>;
@@ -1,11 +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
- import React from 'react';
10
- export declare const RoleResourceCollectionContext: React.Context<any>;
11
- export declare const RolesResourcesActions: React.ForwardRefExoticComponent<Omit<Partial<any>, "ref"> & React.RefAttributes<unknown>>;
@@ -1,11 +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
- import React from 'react';
10
- export declare const useRolesResourcesScopesSelectedRowKeys: () => any;
11
- export declare const ScopeSelect: (props: any) => React.JSX.Element;
@@ -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
- import React from 'react';
10
- export declare const StrategyActions: React.ForwardRefExoticComponent<Omit<Partial<any>, "ref"> & React.RefAttributes<unknown>>;
@@ -1,9 +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
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<import("antd-style").SerializedStyles>;
@@ -1,18 +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
- /// <reference types="react" />
10
- export type RolesManagerOptions = {
11
- title: string;
12
- Component: React.ComponentType<any>;
13
- };
14
- export declare class RolesManager {
15
- rolesManager: any;
16
- add(name: string, options: RolesManagerOptions): void;
17
- list(): any;
18
- }
@@ -1,63 +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
- import { ISchema } from '@formily/react';
10
- export declare const roleEditSchema: {
11
- type: string;
12
- properties: {
13
- [x: string]: {
14
- type: string;
15
- 'x-component': string;
16
- 'x-decorator': string;
17
- 'x-decorator-props': {
18
- useValues: (options: any) => import("@nocobase/client").UseRequestResult<unknown>;
19
- };
20
- title: string;
21
- properties: {
22
- title: {
23
- 'x-component': string;
24
- 'x-decorator': string;
25
- };
26
- name: {
27
- 'x-component': string;
28
- 'x-decorator': string;
29
- 'x-disabled': boolean;
30
- };
31
- default: {
32
- title: string;
33
- 'x-component': string;
34
- 'x-decorator': string;
35
- 'x-content': string;
36
- 'x-reactions': (field: any) => void;
37
- };
38
- footer: {
39
- type: string;
40
- 'x-component': string;
41
- properties: {
42
- cancel: {
43
- title: string;
44
- 'x-component': string;
45
- 'x-component-props': {
46
- useAction: string;
47
- };
48
- };
49
- submit: {
50
- title: string;
51
- 'x-component': string;
52
- 'x-component-props': {
53
- type: string;
54
- useAction: string;
55
- };
56
- };
57
- };
58
- };
59
- };
60
- };
61
- };
62
- };
63
- export declare const roleCollectionsSchema: ISchema;
@@ -1,75 +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
- import { ISchema } from '@formily/react';
10
- export declare const rolesResourcesScopesCollection: {
11
- name: string;
12
- fields: {
13
- type: string;
14
- name: string;
15
- interface: string;
16
- uiSchema: import("@formily/react").Stringify<{
17
- [key: symbol]: any;
18
- [key: `x-${string}`]: any;
19
- [key: `x-${number}`]: any;
20
- version?: string;
21
- name?: import("@formily/react").SchemaKey;
22
- title?: any;
23
- description?: any;
24
- default?: any;
25
- readOnly?: boolean;
26
- writeOnly?: boolean;
27
- type?: import("@formily/react").SchemaTypes;
28
- enum?: import("@formily/react").SchemaEnum<any>;
29
- const?: any;
30
- multipleOf?: number;
31
- maximum?: number;
32
- exclusiveMaximum?: number;
33
- minimum?: number;
34
- exclusiveMinimum?: number;
35
- maxLength?: number;
36
- minLength?: number;
37
- pattern?: string | RegExp;
38
- maxItems?: number;
39
- minItems?: number;
40
- uniqueItems?: boolean;
41
- maxProperties?: number;
42
- minProperties?: number;
43
- required?: string | boolean | string[];
44
- format?: string;
45
- $ref?: string;
46
- $namespace?: string;
47
- definitions?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
48
- properties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
49
- items?: import("@formily/react").SchemaItems<any, any, any, any, any, any, any, any>;
50
- additionalItems?: import("@formily/react").Stringify<any>;
51
- patternProperties?: import("@formily/react").SchemaProperties<any, any, any, any, any, any, any, any>;
52
- additionalProperties?: import("@formily/react").Stringify<any>;
53
- "x-value"?: any;
54
- "x-index"?: number;
55
- "x-pattern"?: any;
56
- "x-display"?: any;
57
- "x-validator"?: any;
58
- "x-decorator"?: any;
59
- "x-decorator-props"?: any;
60
- "x-component"?: any;
61
- "x-component-props"?: any;
62
- "x-reactions"?: import("@formily/react").SchemaReactions<any>;
63
- "x-content"?: any;
64
- "x-data"?: any;
65
- "x-visible"?: boolean;
66
- "x-hidden"?: boolean;
67
- "x-disabled"?: boolean;
68
- "x-editable"?: boolean;
69
- "x-read-only"?: boolean;
70
- "x-read-pretty"?: boolean;
71
- "x-compile-omitted"?: string[];
72
- }>;
73
- }[];
74
- };
75
- export declare const scopesSchema: ISchema;
@@ -1,31 +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
- module.exports = {
11
- "@nocobase/client": "1.2.13-alpha",
12
- "react": "18.2.0",
13
- "@formily/shared": "2.3.0",
14
- "antd": "5.12.8",
15
- "@formily/react": "2.3.0",
16
- "@ant-design/icons": "5.2.6",
17
- "react-i18next": "11.18.6",
18
- "@nocobase/utils": "1.2.13-alpha",
19
- "@nocobase/actions": "1.2.13-alpha",
20
- "@nocobase/cache": "1.2.13-alpha",
21
- "@nocobase/database": "1.2.13-alpha",
22
- "@nocobase/server": "1.2.13-alpha",
23
- "async-mutex": "0.3.2",
24
- "lodash": "4.17.21",
25
- "@nocobase/test": "1.2.13-alpha",
26
- "@formily/core": "2.3.0",
27
- "ahooks": "3.7.8",
28
- "@formily/antd-v5": "1.1.9",
29
- "antd-style": "3.4.5",
30
- "@nocobase/acl": "1.2.13-alpha"
31
- };
package/dist/index.d.ts DELETED
@@ -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
- export * from './server';
10
- export { default } from './server';
package/dist/index.js DELETED
@@ -1,48 +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
- 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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var src_exports = {};
39
- __export(src_exports, {
40
- default: () => import_server.default
41
- });
42
- module.exports = __toCommonJS(src_exports);
43
- __reExport(src_exports, require("./server"), module.exports);
44
- var import_server = __toESM(require("./server"));
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- ...require("./server")
48
- });
@@ -1,6 +0,0 @@
1
- {
2
- "The current user has no roles. Please try another account.": "The current user has no roles. Please try another account.",
3
- "The user role does not exist. Please try signing in again": "The user role does not exist. Please try signing in again",
4
- "New role": "New role",
5
- "Permissions": "Permissions"
6
- }
@@ -1,4 +0,0 @@
1
- {
2
- "The current user has no roles. Please try another account.": "현재 사용자에게 역할이 없습니다. 다른 계정을 시도해주세요.",
3
- "The user role does not exist. Please try signing in again": "사용자 역할이 존재하지 않습니다. 다시 로그인을 시도해주세요."
4
- }
@@ -1,11 +0,0 @@
1
- {
2
- "The current user has no roles. Please try another account.": "当前用户没有角色,请使用其他账号。",
3
- "The user role does not exist. Please try signing in again": "用户角色不存在,请尝试重新登录。",
4
- "New role": "新建角色",
5
- "Permissions": "权限",
6
- "Roles & Permissions": "角色和权限",
7
- "General": "通用",
8
- "Menu": "菜单",
9
- "Plugin settings": "插件设置",
10
- "Data sources": "数据源"
11
- }