@nocobase/plugin-users 1.6.0-alpha.3 → 1.6.0-alpha.31
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/57109fd3173f64b0.js +10 -0
- package/dist/client/75dd12764a8863de.js +10 -0
- package/dist/client/893fe71650db2b0b.js +10 -0
- package/dist/client/ChangePassword.d.ts +10 -0
- package/dist/client/EditProfile.d.ts +10 -0
- package/dist/client/NickName.d.ts +10 -0
- package/dist/client/SignOut.d.ts +10 -0
- package/dist/client/UsersProvider.d.ts +11 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +14 -10
- package/dist/locale/en-US.json +3 -1
- package/dist/locale/it-IT.json +8 -0
- package/dist/locale/ja-JP.json +2 -1
- package/dist/locale/zh-CN.json +3 -1
- package/dist/server/actions/users.d.ts +3 -0
- package/dist/server/actions/users.js +100 -5
- package/dist/server/collections/users.js +3 -1
- package/dist/server/migrations/20241117112824-profile-schema.d.ts +13 -0
- package/dist/server/migrations/20241117112824-profile-schema.js +64 -0
- package/dist/server/migrations/20241221135800-update-password-validator.d.ts +14 -0
- package/dist/server/migrations/20241221135800-update-password-validator.js +57 -0
- package/dist/server/profile/edit-form-schema.d.ts +490 -0
- package/dist/server/profile/edit-form-schema.js +521 -0
- package/dist/server/server.d.ts +4 -2
- package/dist/server/server.js +24 -9
- package/package.json +4 -2
- package/dist/client/06ac3fe39564952e.js +0 -10
- package/dist/client/ce2e4c5e0583a97d.js +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
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_users=self.webpackChunk_nocobase_plugin_users||[]).push([["718"],{404:function(e,t,r){r.r(t),r.d(t,{UsersProvider:function(){return m},useEditProfile:function(){return y}});var n=r(772),o=r(156),i=r.n(o),u=r(888),l=r(875),a=r(505);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,o,i,u){try{var l=e[i](u),a=l.value}catch(e){r(e);return}l.done?t(a):Promise.resolve(a).then(n,o)}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){f(e,t,r[t])})}return e}var p=function(){var e=(0,n.useCurrentUserContext)(),t=(0,n.useActionContext)().setVisible,r=(0,a.useForm)(),o=(0,n.useAPIClient)(),i=(0,a.useFieldSchema)(),u=(0,a.useField)(),l=(0,n.useCollectValuesToSubmit)();return{type:"primary",htmlType:"submit",onClick:function(){var n;return(n=function(){var n,a,s,c,f,p;return function(e,t){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(p){switch(p.label){case 0:if(s=(a=null!==(n=null==i?void 0:i["x-action-settings"])&&void 0!==n?n:{}).triggerWorkflows,a.skipValidator)return[3,2];return[4,r.submit()];case 1:p.sent(),p.label=2;case 2:return[4,l()];case 3:c=p.sent(),u.data=u.data||{},u.data.loading=!0,p.label=4;case 4:return p.trys.push([4,7,,8]),[4,o.resource("users").updateProfile({values:c,triggerWorkflows:(null==s?void 0:s.length)?s.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:return p.sent(),e.mutate({data:d({},null==e?void 0:null===(f=e.data)||void 0===f?void 0:f.data,c)}),[4,r.reset()];case 6:return p.sent(),u.data.loading=!1,t(!1),[3,8];case 7:return p.sent(),u.data.loading=!1,[3,8];case 8:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function u(e){c(i,r,o,u,l,"next",e)}function l(e){c(i,r,o,u,l,"throw",e)}u(void 0)})})()}}},b=function(){var e,t=(0,n.useCollectionManager)().getCollection("users"),r=(0,n.useCurrentUserContext)().data,u=(0,o.useMemo)(function(){var e,r;return e=d({},t),r=(r={name:"users",fields:t.fields.filter(function(e){return!["password","roles"].includes(e.name)})},r),Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e},[t]);return i().createElement(n.ExtendCollectionsProvider,{collections:[u]},i().createElement(n.RemoteSchemaComponent,{uid:"nocobase-user-profile-edit-form",noForm:!0,scope:{useUpdateProfileActionProps:p,currentUserId:null===(e=r.data)||void 0===e?void 0:e.id}}))},y=function(){var e,t,r=(0,o.useContext)(n.DropdownVisibleContext);var a=(e=(0,o.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,l=!1;try{for(o=o.call(e);!(u=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);u=!0);}catch(e){l=!0,n=e}finally{try{!u&&null!=o.return&&o.return()}finally{if(l)throw n}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=a[0],d=a[1],p=(0,u.B)().t,y=((0,n.useSystemSettings)()||{}).data,m=((null==y?void 0:y.data)||{}).enableEditProfile,v=(0,o.useMemo)(function(){return{key:"profile",eventKey:"EditProfile",onClick:function(){d(!0),null==r||r.setVisible(!1)},label:i().createElement("div",null,p("Edit profile"),i().createElement(n.ActionContextProvider,{value:{visible:c,setVisible:d}},i().createElement("div",{onClick:function(e){return e.stopPropagation()}},i().createElement(n.SchemaComponent,{components:{ProfileEditForm:b},schema:{type:"object",properties:f({},(0,l.uid)(),{"x-component":"Action.Drawer","x-component-props":{},type:"void",title:'{{t("Edit profile")}}',properties:{form:{type:"void","x-component":"ProfileEditForm"}}})}}))))}},[c]);return!1===m?null:v},m=function(e){var t=(0,n.useCurrentUserSettingsMenu)().addMenuItem,r=y(),u=(0,n.useSystemSettings)().data,l=((null==u?void 0:u.data)||{}).enableEditProfile;return(0,o.useEffect)(function(){if(!1!==l)t(r,{after:"divider_1"})},[t,r,l]),i().createElement(i().Fragment,null,e.children)}},888:function(e,t,r){r.d(t,{B:function(){return o}});var n=r(238);function o(){return(0,n.useTranslation)(["users","client"],{nsMode:"fallback"})}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
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_users=self.webpackChunk_nocobase_plugin_users||[]).push([["554"],{891:function(e,t,n){n.r(t),n.d(t,{UsersManagement:function(){return B}});var r=n("964"),o=n("563"),a=n("505"),u=n("772"),i=n("721"),s=n("156"),c=n.n(s),l=n("888"),f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n="abcdefghijklmnopqrstuvwxyz",r="0123456789",o="!#$%^&*-_+=",a=t+n+r+o,u=new Uint32Array(e);crypto.getRandomValues(u);var i="";i+=t.charAt(u[0]%t.length),i+=n.charAt(u[1]%n.length),i+=r.charAt(u[2]%r.length),i+=o.charAt(u[3]%o.length);for(var s=4;s<e;s++){var c=u[s]%a.length;i+=a.charAt(c)}return i=i[0]+i.slice(1).split("").sort(function(){return Math.random()-.5}).join("")};function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=function(){var e,t,n=(0,l.B)().t,r=(0,a.useField)();var o=(e=c().useState(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],u=!0,i=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);u=!0);}catch(e){i=!0,r=e}finally{try{!u&&null!=o.return&&o.return()}finally{if(i)throw r}}return a}}(e,2)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=o[0],b=o[1],v=(0,u.useActionContext)();return(0,s.useEffect)(function(){if(!v.visible)r.reset()},[r,v.visible]),(0,s.useEffect)(function(){if(!!r.value)r.validate()},[r.value]),c().createElement(i.Row,{gutter:10},c().createElement(i.Col,{span:18},c().createElement(u.Password,{checkStrength:!0,visibilityToggle:{visible:m,onVisibleChange:b},value:r.value,onChange:function(e){return r.setValue(e.target.value)},autoComplete:"new-password"})),c().createElement(i.Col,{span:4},c().createElement(i.Button,{onClick:function(){r.setValue(f()),b(!0)}},n("Random password"))))},b=n("241");function v(e,t,n,r,o,a,u){try{var i=e[a](u),s=i.value}catch(e){n(e);return}i.done?t(s):Promise.resolve(s).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){v(a,r,o,u,i,"next",e)}function i(e){v(a,r,o,u,i,"throw",e)}u(void 0)})}}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,a;r=e,o=t,a=n[t],o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a})}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function g(e,t){var n,r,o,a,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}}function C(){var e,t,n=(e=["\n .ant-tabs-nav {\n margin-bottom: 0px;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return C=function(){return n},n}var w=function(){var e=(0,u.useActionContext)().setVisible,t=(0,a.useForm)();return{type:"default",onClick:function(){e(!1),t.reset()}}},P=function(){var e=(0,u.useActionContext)().setVisible,t=i.App.useApp().message,n=(0,a.useForm)(),r=(0,u.useDataBlockResource)(),o=(0,u.useDataBlockRequest)().refresh,s=(0,l.B)().t,c=(0,u.useCollection)();return{htmlType:"submit",type:"primary",onClick:function(){return d(function(){var a;return g(this,function(u){switch(u.label){case 0:return[4,n.submit()];case 1:if(u.sent(),!(a=n.values)[c.filterTargetKey])return[3,3];return[4,r.update({values:a,filterByTk:a[c.filterTargetKey]})];case 2:return u.sent(),[3,5];case 3:return[4,r.create({values:a})];case 4:u.sent(),u.label=5;case 5:return o(),t.success(s("Saved successfully")),e(!1),n.reset(),[2]}})})()}}},S=function(){var e=(0,u.useCollectionRecordData)();return{form:(0,s.useMemo)(function(){return(0,o.createForm)({initialValues:e})},[e])}},E=function(){return c().createElement(u.RemoteSchemaComponent,{uid:"nocobase-admin-profile-create-form",noForm:!0})},O=function(){var e=(0,u.useCollectionManager)().getCollection("users"),t=h(y({},e),{name:"users",fields:e.fields.filter(function(e){return"password"!==e.name})});return c().createElement(u.ExtendCollectionsProvider,{collections:[t]},c().createElement(u.RemoteSchemaComponent,{uid:"nocobase-admin-profile-edit-form",noForm:!0,scope:{useCancelActionProps:w}}))},A=function(){var e=(0,u.useSchemaComponentContext)();return c().createElement(u.SchemaComponentContext.Provider,{value:h(y({},e),{designable:!1})},c().createElement(u.SchemaComponent,{schema:{type:"void",properties:{filter:{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"}}}}}))},j=function(){var e=(0,l.B)().t,t=(0,u.useCollectionManager)();return(0,s.useMemo)(function(){return null==t?void 0:t.getCollection("users")},[t])?c().createElement(u.SchemaComponent,{schema:b.SN,scope:{t:e,useCancelActionProps:w,useSubmitActionProps:P,useEditFormProps:S},components:{PasswordField:m,ProfileEditForm:O,ProfileCreateForm:E,FilterAction:A}}):c().createElement(i.Spin,null)},k=(0,s.createContext)({}),F=function(e){var t=(0,u.useRequest)({url:"users:getSystemSettings"});return c().createElement(k.Provider,{value:t},e.children)},x=function(){var e=(0,l.B)().t,t=(0,a.useForm)();return c().createElement(u.SchemaComponent,{schema:b.eF,scope:{t:e,useFormBlockProps:function(){var e,n=(0,s.useContext)(k),r=(null==n?void 0:null===(e=n.data)||void 0===e?void 0:e.data)||{},o=r.enableChangePassword,a=r.enableEditProfile;return(0,s.useEffect)(function(){null==t||t.setValues({enableChangePassword:!1!==o,enableEditProfile:!1!==a})},[n]),{form:t}},useSubmitActionProps:function(){var t=(0,u.useAPIClient)(),n=(0,a.useForm)();return{type:"primary",onClick:function(){return d(function(){var r;return g(this,function(o){switch(o.label){case 0:return[4,n.submit()];case 1:return o.sent(),r=n.values,[4,t.request({url:"users:updateSystemSettings",data:r,method:"POST"})];case 2:return o.sent(),i.message.success(e("Saved successfully")),window.location.reload(),[2]}})})()}}}},components:{UsersSettingsProvider:F}})},B=function(){var e=(0,l.B)().t;return c().createElement(i.Tabs,{defaultActiveKey:"usersManager",type:"card",className:(0,r.css)(C()),items:[{label:e("Users manager"),key:"usersManager",children:c().createElement(j,null)},{label:e("Settings"),key:"usersSettings",children:c().createElement(x,null)}]})}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
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_users=self.webpackChunk_nocobase_plugin_users||[]).push([["360"],{888:function(e,o,t){t.d(o,{B:function(){return r}});var n=t(238);function r(){return(0,n.useTranslation)(["users","client"],{nsMode:"fallback"})}},241:function(e,o,t){t.d(o,{Lu:function(){return s},SN:function(){return i},eF:function(){return c},ij:function(){return p}});var n=t(875);function r(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}var p={name:"users",fields:[{name:"id",type:"bigInt",autoIncrement:!0,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0},interface:"id"},{interface:"input",type:"string",name:"nickname",uiSchema:{type:"string",title:'{{t("Nickname")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"username",unique:!0,uiSchema:{type:"string",title:'{{t("Username")}}',"x-component":"Input","x-validator":{username:!0},required:!0}},{interface:"email",type:"string",name:"email",unique:!0,uiSchema:{type:"string",title:'{{t("Email")}}',"x-component":"Input","x-validator":"email",required:!0}},{interface:"phone",type:"string",name:"phone",unique:!0,uiSchema:{type:"string",title:'{{t("Phone")}}',"x-component":"Input",required:!0}},{interface:"password",type:"password",name:"password",hidden:!0,uiSchema:{type:"string",title:'{{t("Password")}}',"x-component":"Password"}},{interface:"m2m",type:"belongsToMany",name:"roles",target:"roles",foreignKey:"userId",otherKey:"roleName",onDelete:"CASCADE",sourceKey:"id",targetKey:"name",through:"rolesUsers",uiSchema:{type:"array",title:'{{t("Roles")}}',"x-component":"AssociationField","x-component-props":{multiple:!0,fieldNames:{label:"title",value:"name"}}}}]},i={type:"object",properties:{block1:{type:"void","x-component":"CardItem","x-component-props":{heightMode:"fullHeight"},"x-decorator":"TableBlockProvider","x-decorator-props":{dataSource:"main",rowKey:"id",collection:"users",action:"list",params:{pageSize:20}},"x-use-decorator-props":"useTableBlockDecoratorProps",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:"var(--nb-spacing)"}},properties:{filter:{type:"void","x-component":"FilterAction","x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-action":"refresh","x-component":"Action","x-component-props":{icon:"ReloadOutlined"},"x-use-component-props":"useRefreshActionProps"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{confirm:{title:"{{t('Delete users')}}",content:"{{t('Are you sure you want to delete it?')}}"},icon:"DeleteOutlined"},"x-use-component-props":"useBulkDestroyActionProps"},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2",title:'{{t("Add user")}}',properties:{form:{type:"void","x-component":"ProfileCreateForm"}}}}}}},table:{type:"array","x-uid":"input","x-component":"TableV2","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},"x-use-component-props":"useTableBlockProps",properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{nickname:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",title:'{{t("Roles")}}',properties:{roles:{"x-component":"CollectionField","x-component-props":{mode:"Tag",enableLink:!1,ellipsis:!0},"x-read-pretty":!0,"x-collection-field":"users.roles"}}},column5:{type:"void",title:'{{t("Actions")}}',"x-component":"TableV2.Column","x-decorator":"TableV2.Column.ActionBar",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit profile")}}',"x-decorator":"ACLActionProvider","x-acl-action":"users:update","x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer",title:'{{t("Edit profile")}}',properties:{form:{type:"void","x-component":"ProfileEditForm"}}}}},changePassword:{type:"void",title:'{{t("Change password")}}',"x-decorator":"ACLActionProvider","x-acl-action":"users:update","x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormProps",title:'{{t("Change password")}}',properties:{username:{"x-component":"CollectionField","x-component-props":{hidden:!0}},password:{"x-component":"CollectionField","x-component-props":{component:"PasswordField"},"x-decorator":"FormItem",required:!0},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-use-component-props":"useCancelActionProps"},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary"},"x-use-component-props":"useSubmitActionProps"}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-acl-action":"users:destroy","x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-use-component-props":"useDestroyActionProps"}}}}}}}}}}},c={type:"object","x-decorator":"UsersSettingsProvider",properties:{usersSettings:{type:"void","x-component":"CardItem","x-decorator":"UsersSettingsProvider",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{enableEditProfile:{type:"string","x-component":"Checkbox","x-decorator":"FormItem",default:!0,"x-content":'{{t("Allow edit profile")}}'},enableChangePassword:{type:"string","x-component":"Checkbox","x-decorator":"FormItem",default:!0,"x-content":'{{t("Allow change password")}}'},submit:{title:'{{t("Save")}}',"x-component":"Action","x-use-component-props":"useSubmitActionProps"}}}}}}},s=function(){var e;return{type:"void",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:(r(e={},(0,n.uid)(),{type:"void",title:'{{ t("Filter") }}',"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"}),r(e,"actions",{type:"void","x-component":"Space",properties:{remove:{type:"void",title:'{{t("Remove")}}',"x-component":"Action","x-component-props":{icon:"MinusOutlined",confirm:{title:"{{t('Remove')}}",content:"{{t('Are you sure you want to remove these users?')}}"},style:{marginRight:8},useAction:"{{ useBulkRemoveUsers }}"}},create:{type:"void",title:'{{t("Add users")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"FormV2",title:'{{t("Add users")}}',properties:{resource:{type:"void","x-decorator":"FormItem","x-component":"RoleUsersProvider",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{username:{$includes:""}},{nickname:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox",onChange:"{{ handleSelectRoleUsers }}"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{username:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},phone:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{phone:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},email:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}}}}}},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:"{{ useAddRoleUsers }}"}}}}}}}}}}),e)},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{username:{type:"void",title:'{{t("Username")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},nickname:{type:"void",title:'{{t("Nickname")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{nickname:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{remove:{type:"void",title:'{{ t("Remove") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Remove user')}}",content:"{{t('Are you sure you want to remove it?')}}"},useAction:"{{ useRemoveUser }}"}}}}}}}}}}}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
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 ChangePassword: () => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 EditProfile: () => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 NickName: () => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
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 SignOut: () => React.JSX.Element;
|
|
@@ -0,0 +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
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export declare const useEditProfile: () => import("antd/es/menu/hooks/useItems").ItemType;
|
|
11
|
+
export declare const UsersProvider: React.FC;
|
package/dist/client/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("react-i18next"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@formily/core"),require("@nocobase/client"),require("antd"),require("@formily/react"),require("react"),require("@emotion/css")):"function"==typeof define&&define.amd?define("@nocobase/plugin-users",["react-i18next","@formily/shared","@nocobase/plugin-acl/client","@nocobase/utils/client","@formily/core","@nocobase/client","antd","@formily/react","react","@emotion/css"],t):"object"==typeof exports?exports["@nocobase/plugin-users"]=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@formily/core"),require("@nocobase/client"),require("antd"),require("@formily/react"),require("react"),require("@emotion/css")):e["@nocobase/plugin-users"]=t(e["react-i18next"],e["@formily/shared"],e["@nocobase/plugin-acl/client"],e["@nocobase/utils/client"],e["@formily/core"],e["@nocobase/client"],e.antd,e["@formily/react"],e.react,e["@emotion/css"])}(self,function(e,t,n,r,o,i,u,c,a,s){return function(){var l,f,p,d,b,y={581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},964:function(e){"use strict";e.exports=s},563:function(e){"use strict";e.exports=o},505:function(e){"use strict";e.exports=c},875:function(e){"use strict";e.exports=t},772:function(e){"use strict";e.exports=i},465:function(e){"use strict";e.exports=n},584:function(e){"use strict";e.exports=r},721:function(e){"use strict";e.exports=u},156:function(e){"use strict";e.exports=a},238:function(t){"use strict";t.exports=e}},m={};function h(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return y[e](n,n.exports,h),n.exports}h.m=y,h.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return h.d(t,{a:t}),t},h.d=function(e,t){for(var n in t)h.o(t,n)&&!h.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},h.f={},h.e=function(e){return Promise.all(Object.keys(h.f).reduce(function(t,n){return h.f[n](e,t),t},[]))},h.u=function(e){return""+({114:"e727dfc0317bc5a0",360:"ce2e4c5e0583a97d",554:"06ac3fe39564952e"})[e]+".js"},h.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l={},f="@nocobase/plugin-users:",h.l=function(e,t,n,r){if(l[e]){l[e].push(t);return}if(void 0!==n){for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var a=u[c];if(a.getAttribute("src")==e||a.getAttribute("data-webpack")==f+n){o=a;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,h.nc&&o.setAttribute("nonce",h.nc),o.setAttribute("data-webpack",f+n),o.src=e),l[e]=[t];var s=function(t,n){o.onerror=o.onload=null,clearTimeout(p);var r=l[e];if(delete l[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=s.bind(null,o.onerror),o.onload=s.bind(null,o.onload),i&&document.head.appendChild(o)},h.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},h.p="/static/plugins/@nocobase/plugin-users/dist/client/",p={909:0},h.f.j=function(e,t){var n=h.o(p,e)?p[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=p[e]=[t,r]});t.push(n[2]=r);var o=h.p+h.u(e),i=Error();h.l(o,function(t){if(h.o(p,e)&&(0!==(n=p[e])&&(p[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)}}},d=function(e,t){var n=t[0],r=t[1],o=t[2],i,u,c=0;if(n.some(function(e){return 0!==p[e]})){for(i in r)h.o(r,i)&&(h.m[i]=r[i]);o&&o(h)}for(e&&e(t);c<n.length;c++)u=n[c],h.o(p,u)&&p[u]&&p[u][0](),p[u]=0},(b=self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).forEach(d.bind(null,0)),b.push=d.bind(null,b.push.bind(b));var v={};return!function(){"use strict";h.r(v);var e=h(772),t=h(584),n=h(465),r=h.n(n),o=h(581);function i(e,t,n,r,o,i,u){try{var c=e[i](u),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function u(e,t,n){return(u=f()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o}).apply(null,arguments)}function c(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)}}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e){var t="function"==typeof Map?new Map:void 0;return(l=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).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,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),s(r,e)})(e)}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var p=(0,e.lazy)(function(){return o("imported_-193g1io_component",Promise.all([h.e("360"),h.e("554")]).then(h.bind(h,891)))},"UsersManagement").UsersManagement,d=(0,e.lazy)(function(){return o("imported_-121r5eb_component",Promise.all([h.e("360"),h.e("114")]).then(h.bind(h,132)))},"RoleUsersManager").RoleUsersManager,b=function(e){var n,o,u;function l(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,l),e=this,t=l,n=arguments,t=a(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],a(e).constructor):t.apply(e,n))}return!function(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&&s(e,t)}(l,e),n=l,o=[{key:"load",value:function(){var e,n=this;return(e=function(){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(e){return n.app.pluginSettingsManager.add("users-permissions",{title:(0,t.tval)("Users & Permissions",{ns:"users"}),icon:"TeamOutlined"}),n.app.pluginSettingsManager.add("users-permissions.users",{title:(0,t.tval)("Users"),icon:"UserOutlined",Component:p,aclSnippet:"pm.users"}),n.app.pm.get(r()).rolesManager.add("users",{title:(0,t.tval)("Users"),Component:d}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function c(e){i(u,r,o,c,a,"next",e)}function a(e){i(u,r,o,c,a,"throw",e)}c(void 0)})})()}}],c(n.prototype,o),l}(l(e.Plugin));v.default=b}(),v}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@nocobase/client"),require("@formily/core"),require("antd"),require("@formily/react"),require("react-router-dom"),require("react"),require("@emotion/css")):"function"==typeof define&&define.amd?define("@nocobase/plugin-users",["react-i18next","@formily/shared","@nocobase/plugin-acl/client","@nocobase/utils/client","@nocobase/client","@formily/core","antd","@formily/react","react-router-dom","react","@emotion/css"],t):"object"==typeof exports?exports["@nocobase/plugin-users"]=t(require("react-i18next"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@nocobase/client"),require("@formily/core"),require("antd"),require("@formily/react"),require("react-router-dom"),require("react"),require("@emotion/css")):e["@nocobase/plugin-users"]=t(e["react-i18next"],e["@formily/shared"],e["@nocobase/plugin-acl/client"],e["@nocobase/utils/client"],e["@nocobase/client"],e["@formily/core"],e.antd,e["@formily/react"],e["react-router-dom"],e.react,e["@emotion/css"])}(self,function(e,t,n,r,o,i,u,a,s,c,l){return function(){var f,p,d,m,b,y,v={581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},964:function(e){"use strict";e.exports=l},563:function(e){"use strict";e.exports=i},505:function(e){"use strict";e.exports=a},875:function(e){"use strict";e.exports=t},772:function(e){"use strict";e.exports=o},465:function(e){"use strict";e.exports=n},584:function(e){"use strict";e.exports=r},721:function(e){"use strict";e.exports=u},156:function(e){"use strict";e.exports=c},238:function(t){"use strict";t.exports=e},128:function(e){"use strict";e.exports=s}},h={};function g(e){var t=h[e];if(void 0!==t)return t.exports;var n=h[e]={exports:{}};return v[e](n,n.exports,g),n.exports}g.m=v,g.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return g.d(t,{a:t}),t},g.d=function(e,t){for(var n in t)g.o(t,n)&&!g.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},g.f={},g.e=function(e){return Promise.all(Object.keys(g.f).reduce(function(t,n){return g.f[n](e,t),t},[]))},g.u=function(e){return""+({114:"e727dfc0317bc5a0",360:"893fe71650db2b0b",554:"75dd12764a8863de",718:"57109fd3173f64b0"})[e]+".js"},g.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),g.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},f={},p="@nocobase/plugin-users:",g.l=function(e,t,n,r){if(f[e]){f[e].push(t);return}if(void 0!==n){for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var s=u[a];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==p+n){o=s;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,g.nc&&o.setAttribute("nonce",g.nc),o.setAttribute("data-webpack",p+n),o.src=e),f[e]=[t];var c=function(t,n){o.onerror=o.onload=null,clearTimeout(l);var r=f[e];if(delete f[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},l=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),i&&document.head.appendChild(o)},g.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},g.p=(!(d=window.__nocobase_public_path__||"/").endsWith("/")&&(d+="/"),d+"static/plugins/@nocobase/plugin-users/dist/client/"),m={909:0},g.f.j=function(e,t){var n=g.o(m,e)?m[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=m[e]=[t,r]});t.push(n[2]=r);var o=g.p+g.u(e),i=Error();g.l(o,function(t){if(g.o(m,e)&&(0!==(n=m[e])&&(m[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)}}},b=function(e,t){var n=t[0],r=t[1],o=t[2],i,u,a=0;if(n.some(function(e){return 0!==m[e]})){for(i in r)g.o(r,i)&&(g.m[i]=r[i]);o&&o(g)}for(e&&e(t);a<n.length;a++)u=n[a],g.o(m,u)&&m[u]&&m[u][0](),m[u]=0},(y=self.webpackChunk_nocobase_plugin_users=self.webpackChunk_nocobase_plugin_users||[]).forEach(b.bind(null,0)),y.push=b.bind(null,y.push.bind(y));var w={};return!function(){"use strict";g.r(w),g.d(w,{default:function(){return G}});var e,t,n,r=g("772"),o=g("584"),i=g("465"),u=g.n(i),a=g("505"),s=g("875"),c=g("238"),l=g("128"),f=g("156"),p=g.n(f);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,o,i,u){try{var a=e[i](u),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,o)}function b(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){m(i,r,o,u,a,"next",e)}function a(e){m(i,r,o,u,a,"throw",e)}u(void 0)})}}function y(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var v=function(){var e=(0,r.useActionContext)().setVisible,t=(0,a.useForm)();return{run:function(){return b(function(){return y(this,function(n){switch(n.label){case 0:return e(!1),[4,t.reset()];case 1:return n.sent(),[2]}})})()}}},h=function(){var e=(0,l.useNavigate)(),t=(0,r.useActionContext)().setVisible,n=(0,a.useForm)(),o=(0,r.useAPIClient)();return{run:function(){return b(function(){return y(this,function(r){switch(r.label){case 0:return[4,n.submit()];case 1:return r.sent(),[4,o.resource("auth").changePassword({values:n.values})];case 2:return r.sent(),[4,n.reset()];case 3:return r.sent(),t(!1),e("/signin"),[2]}})})()}}};var x={type:"object",properties:(e={},t=(0,s.uid)(),n={"x-decorator":"Form","x-component":"Action.Drawer","x-component-props":{zIndex:2e3},type:"void",title:'{{t("Change password")}}',properties:{oldPassword:{type:"string",title:'{{t("Old password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem"},newPassword:{type:"string",title:'{{t("New password")}}',required:!0,"x-component":"Password","x-decorator":"FormItem","x-validator":{password:!0},"x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirmPassword"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirmPassword:{type:"string",required:!0,title:'{{t("Confirm password")}}',"x-component":"Password","x-decorator":"FormItem","x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".newPassword"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},footer:{"x-component":"Action.Drawer.Footer",type:"void",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ useCloseAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useSaveCurrentUserValues }}"}}}}}},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},P=function(){var e,t,n=(0,f.useContext)(r.DropdownVisibleContext);var o=(e=(0,f.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,r=e}finally{try{!u&&null!=o.return&&o.return()}finally{if(a)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],u=o[1],a=(0,c.useTranslation)().t,s=((0,r.useSystemSettings)()||{}).data,l=((null==s?void 0:s.data)||{}).enableChangePassword,m=(0,r.useZIndexContext)()+10,b=(0,f.useCallback)(function(e){var t;e.stopPropagation(),null==n||null===(t=n.setVisible)||void 0===t||t.call(n,!1),u(function(e){return!e||e})},[n]),y=(0,f.useMemo)(function(){return p().createElement(r.SchemaComponentContext.Provider,{value:{designable:!1}},p().createElement(r.SchemaComponent,{scope:{useCloseAction:v,useSaveCurrentUserValues:h},schema:x}))},[m]);return!1===l?null:p().createElement(r.zIndexContext.Provider,{value:m},p().createElement(r.SchemaSettingsItem,{eventKey:"changePassword",title:"changePassword"},p().createElement("div",{onClick:b},a("Change password"))),p().createElement(r.ActionContextProvider,{value:{visible:i,setVisible:u}},i&&p().createElement("div",{onClick:function(e){return e.stopPropagation()}},y)))};function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function S(e,t,n,r,o,i,u){try{var a=e[i](u),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,o)}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){k(e,t,n[t])})}return e}var E=function(){var e=(0,r.useCurrentUserContext)(),t=(0,r.useActionContext)().setVisible,n=(0,a.useForm)(),o=(0,r.useAPIClient)(),i=(0,a.useFieldSchema)(),u=(0,a.useField)(),s=(0,r.useCollectValuesToSubmit)();return{type:"primary",htmlType:"submit",onClick:function(){var r;return(r=function(){var r,a,c,l,f,p;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(p){switch(p.label){case 0:if(c=(a=null!==(r=null==i?void 0:i["x-action-settings"])&&void 0!==r?r:{}).triggerWorkflows,a.skipValidator)return[3,2];return[4,n.submit()];case 1:p.sent(),p.label=2;case 2:return[4,s()];case 3:l=p.sent(),u.data=u.data||{},u.data.loading=!0,p.label=4;case 4:return p.trys.push([4,7,,8]),[4,o.resource("users").updateProfile({values:l,triggerWorkflows:(null==c?void 0:c.length)?c.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:return p.sent(),e.mutate({data:O({},null==e?void 0:null===(f=e.data)||void 0===f?void 0:f.data,l)}),[4,n.reset()];case 6:return p.sent(),u.data.loading=!1,t(!1),[3,8];case 7:return p.sent(),u.data.loading=!1,[3,8];case 8:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function u(e){S(i,n,o,u,a,"next",e)}function a(e){S(i,n,o,u,a,"throw",e)}u(void 0)})})()}}},j=function(){var e=((0,r.useCurrentUserContext)()||{}).data;return{record:null==e?void 0:e.data}},_=function(){var e=(0,r.useActionContext)().setVisible;return{type:"default",onClick:function(){e(!1)}}},A=function(){var e=(0,f.useContext)(r.DropdownVisibleContext),t=(0,r.useCollectionManager)().getCollection("users"),n=(0,f.useMemo)(function(){var e,n;return e=O({},t),n=(n={name:"users",fields:t.fields.filter(function(e){return!["password","roles"].includes(e.name)})},n),Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}),e},[t]);return(0,f.useEffect)(function(){null==e||e.setVisible(!1)},[e]),p().createElement(r.ExtendCollectionsProvider,{collections:[n]},p().createElement(r.RemoteSchemaComponent,{uid:"nocobase-user-profile-edit-form",noForm:!0,scope:{useUpdateProfileActionProps:E,useEditFormBlockDecoratorProps:j,useCancelActionProps:_}}))},I=function(){var e,t,n,o=(0,f.useContext)(r.DropdownVisibleContext);var i=(e=(0,f.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(e);!(u=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);u=!0);}catch(e){a=!0,r=e}finally{try{!u&&null!=o.return&&o.return()}finally{if(a)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=i[0],a=i[1],l=(0,c.useTranslation)().t,d=((0,r.useSystemSettings)()||{}).data,m=(null!==(n=null==d?void 0:d.data)&&void 0!==n?n:{}).enableEditProfile,b=(0,r.useZIndexContext)()+10,y=(0,f.useCallback)(function(e){var t;e.stopPropagation(),null==o||null===(t=o.setVisible)||void 0===t||t.call(o,!1),a(function(e){return!e||e})},[o]),v=(0,f.useMemo)(function(){return p().createElement(r.SchemaComponent,{components:{ProfileEditForm:A},schema:{type:"object",properties:k({},(0,s.uid)(),{"x-component":"Action.Drawer","x-component-props":{zIndex:b},type:"void",title:'{{t("Edit profile")}}',properties:{form:{type:"void","x-component":"ProfileEditForm"}}})}})},[b]);return!1===m?null:p().createElement(r.zIndexContext.Provider,{value:b},p().createElement(r.SchemaSettingsItem,{eventKey:"EditProfile",title:"EditProfile"},p().createElement("div",{onClick:y},l("Edit profile"))),p().createElement(r.ActionContextProvider,{value:{visible:u,setVisible:a}},u&&p().createElement("div",{onClick:function(e){return e.stopPropagation()}},v)))},q=function(){var e,t,n,o=(0,r.useCurrentUserContext)().data,i=(0,r.useToken)().token;return p().createElement(r.SchemaSettingsItem,{disabled:!0,eventKey:"nickname",title:"nickname"},p().createElement("span",{"aria-disabled":"false",style:{cursor:"text",color:i.colorTextDescription}},(null==o?void 0:null===(e=o.data)||void 0===e?void 0:e.nickname)||(null==o?void 0:null===(t=o.data)||void 0===t?void 0:t.username)||(null==o?void 0:null===(n=o.data)||void 0===n?void 0:n.email)))};function U(e,t,n,r,o,i,u){try{var a=e[i](u),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,o)}var T=function(){var e,t=(0,c.useTranslation)().t,n=(0,r.useNavigateNoUpdate)(),o=(0,r.useAPIClient)();return p().createElement(r.SchemaSettingsItem,{title:"signOut",eventKey:"signOut",onClick:(e=function(){var e,t;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(r){switch(r.label){case 0:return[4,o.auth.signOut()];case 1:return(null==(t=r.sent().data)?void 0:null===(e=t.data)||void 0===e?void 0:e.redirect)?window.location.href=t.data.redirect:n("/signin?redirect=".concat(encodeURIComponent(""))),[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){U(i,r,o,u,a,"next",e)}function a(e){U(i,r,o,u,a,"throw",e)}u(void 0)})})},t("Sign out"))},M=g(581);function F(e,t,n,r,o,i,u){try{var a=e[i](u),s=a.value}catch(e){n(e);return}a.done?t(s):Promise.resolve(s).then(r,o)}function V(e,t,n){return(V=R()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&z(o,n.prototype),o}).apply(null,arguments)}function D(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)}}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).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,r)}function r(){return V(e,arguments,$(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),z(r,e)})(e)}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}(0,r.lazy)(function(){return M("imported_eeob5k_component",g.e("718").then(g.bind(g,404)))},"UsersProvider").UsersProvider;var B=(0,r.lazy)(function(){return M("imported_-193g1io_component",Promise.all([g.e("360"),g.e("554")]).then(g.bind(g,891)))},"UsersManagement").UsersManagement,K=(0,r.lazy)(function(){return M("imported_-121r5eb_component",Promise.all([g.e("360"),g.e("114")]).then(g.bind(g,132)))},"RoleUsersManager").RoleUsersManager,G=function(e){var t,n,r;function i(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,i),e=this,t=i,n=arguments,t=$(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,R()?Reflect.construct(t,n||[],$(e).constructor):t.apply(e,n))}return!function(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&&z(e,t)}(i,e),t=i,n=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(e){return t.app.pluginSettingsManager.add("users-permissions",{title:(0,o.tval)("Users & Permissions",{ns:"users"}),icon:"TeamOutlined"}),t.app.pluginSettingsManager.add("users-permissions.users",{title:(0,o.tval)("Users"),icon:"UserOutlined",Component:B,aclSnippet:"pm.users"}),t.app.pm.get(u()).rolesManager.add("users",{title:(0,o.tval)("Users"),Component:K}),t.app.addUserCenterSettingsItem({name:"nickName",Component:q,sort:0}),t.app.addUserCenterSettingsItem({name:"divider1",type:"divider",sort:10}),t.app.addUserCenterSettingsItem({name:"editProfile",Component:I,sort:50}),t.app.addUserCenterSettingsItem({name:"changePassword",Component:P,sort:100}),t.app.addUserCenterSettingsItem({name:"divider_signOut",type:"divider",sort:900}),t.app.addUserCenterSettingsItem({name:"signOut",Component:T,sort:1e3}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function u(e){F(i,r,o,u,a,"next",e)}function a(e){F(i,r,o,u,a,"throw",e)}u(void 0)})})()}}],D(t.prototype,n),i}(N(r.Plugin))}(),w}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,19 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
+
"@formily/react": "2.3.0",
|
|
12
|
+
"@formily/shared": "2.3.2",
|
|
13
|
+
"react-i18next": "11.18.6",
|
|
14
|
+
"react-router-dom": "6.28.1",
|
|
11
15
|
"react": "18.2.0",
|
|
16
|
+
"@nocobase/client": "1.6.0-alpha.31",
|
|
12
17
|
"antd": "5.12.8",
|
|
13
|
-
"@nocobase/client": "1.6.0-alpha.3",
|
|
14
|
-
"@formily/react": "2.3.0",
|
|
15
18
|
"@formily/core": "2.3.0",
|
|
16
|
-
"@nocobase/plugin-acl": "1.6.0-alpha.
|
|
19
|
+
"@nocobase/plugin-acl": "1.6.0-alpha.31",
|
|
17
20
|
"@emotion/css": "11.13.0",
|
|
18
|
-
"@nocobase/utils": "1.6.0-alpha.
|
|
19
|
-
"
|
|
20
|
-
"@nocobase/
|
|
21
|
-
"@nocobase/
|
|
22
|
-
"@nocobase/plugin-
|
|
21
|
+
"@nocobase/utils": "1.6.0-alpha.31",
|
|
22
|
+
"@nocobase/database": "1.6.0-alpha.31",
|
|
23
|
+
"@nocobase/server": "1.6.0-alpha.31",
|
|
24
|
+
"@nocobase/plugin-user-data-sync": "1.6.0-alpha.31",
|
|
25
|
+
"@nocobase/plugin-ui-schema-storage": "1.6.0-alpha.31",
|
|
23
26
|
"lodash": "4.17.21",
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
27
|
+
"@nocobase/actions": "1.6.0-alpha.31",
|
|
28
|
+
"sequelize": "6.35.2",
|
|
29
|
+
"@nocobase/plugin-system-settings": "1.6.0-alpha.31"
|
|
26
30
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Users & Permissions": "Users & Permissions",
|
|
3
3
|
"Add users": "Add users",
|
|
4
|
+
"Add user": "Add user",
|
|
4
5
|
"Remove user": "Remove user",
|
|
5
6
|
"Are you sure you want to remove it?": "Are you sure you want to remove it?",
|
|
6
|
-
"Random password": "Random password"
|
|
7
|
+
"Random password": "Random password",
|
|
8
|
+
"User profile is not allowed to be edited": "User profile is not allowed to be edited"
|
|
7
9
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Users & Permissions": "Utenti e Permessi",
|
|
3
|
+
"Add users": "Aggiungi utenti",
|
|
4
|
+
"Remove user": "Rimuovi utente",
|
|
5
|
+
"Are you sure you want to remove it?": "Sei sicuro di volerlo rimuovere?",
|
|
6
|
+
"Random password": "Password casuale",
|
|
7
|
+
"User profile is not allowed to be edited": "Il profilo utente non può essere modificato"
|
|
8
|
+
}
|
package/dist/locale/ja-JP.json
CHANGED
package/dist/locale/zh-CN.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Users & Permissions": "用户和权限",
|
|
3
3
|
"Add users": "添加用户",
|
|
4
|
+
"Add user": "添加用户",
|
|
4
5
|
"Remove user": "移除用户",
|
|
5
6
|
"Are you sure you want to remove it?": "你确定要移除吗?",
|
|
6
7
|
"Random password": "随机密码",
|
|
7
8
|
"Users manager": "用户管理",
|
|
8
9
|
"Allow edit profile": "允许修改个人资料",
|
|
9
|
-
"Allow change password": "允许修改密码"
|
|
10
|
+
"Allow change password": "允许修改密码",
|
|
11
|
+
"User profile is not allowed to be edited": "用户资料不允许修改"
|
|
10
12
|
}
|
|
@@ -8,4 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { Context, Next } from '@nocobase/actions';
|
|
10
10
|
export declare function updateProfile(ctx: Context, next: Next): Promise<void>;
|
|
11
|
+
export declare function updateLang(ctx: Context, next: Next): Promise<void>;
|
|
11
12
|
export declare const listExcludeRole: (ctx: Context, next: Next) => Promise<void>;
|
|
13
|
+
export declare const getSystemSettings: (ctx: Context, next: Next) => Promise<void>;
|
|
14
|
+
export declare const updateSystemSettings: (ctx: Context, next: Next) => Promise<void>;
|
|
@@ -36,26 +36,90 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
36
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
37
|
var users_exports = {};
|
|
38
38
|
__export(users_exports, {
|
|
39
|
+
getSystemSettings: () => getSystemSettings,
|
|
39
40
|
listExcludeRole: () => listExcludeRole,
|
|
40
|
-
|
|
41
|
+
updateLang: () => updateLang,
|
|
42
|
+
updateProfile: () => updateProfile,
|
|
43
|
+
updateSystemSettings: () => updateSystemSettings
|
|
41
44
|
});
|
|
42
45
|
module.exports = __toCommonJS(users_exports);
|
|
43
46
|
var import_actions = require("@nocobase/actions");
|
|
44
47
|
var import_lodash = __toESM(require("lodash"));
|
|
48
|
+
var import__ = require("..");
|
|
49
|
+
var import_sequelize = require("sequelize");
|
|
50
|
+
function parseProfileFormSchema(schema) {
|
|
51
|
+
const properties = import_lodash.default.get(schema, "properties.form.properties.edit.properties.grid.properties") || {};
|
|
52
|
+
const fields = [];
|
|
53
|
+
const requiredFields = [];
|
|
54
|
+
Object.values(properties).forEach((row) => {
|
|
55
|
+
const col = Object.values(row.properties)[0];
|
|
56
|
+
const [name, props] = Object.entries(col.properties)[0];
|
|
57
|
+
if (props["x-read-pretty"] || props["x-disable"]) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (props["required"]) {
|
|
61
|
+
requiredFields.push(name);
|
|
62
|
+
}
|
|
63
|
+
fields.push(name);
|
|
64
|
+
});
|
|
65
|
+
return { fields, requiredFields };
|
|
66
|
+
}
|
|
45
67
|
async function updateProfile(ctx, next) {
|
|
68
|
+
const systemSettings = ctx.db.getRepository("systemSettings");
|
|
69
|
+
const settings = await systemSettings.findOne();
|
|
70
|
+
const enableEditProfile = settings.get("enableEditProfile");
|
|
71
|
+
if (enableEditProfile === false) {
|
|
72
|
+
ctx.throw(403, ctx.t("User profile is not allowed to be edited", { ns: import__.namespace }));
|
|
73
|
+
}
|
|
46
74
|
const values = ctx.action.params.values || {};
|
|
47
75
|
const { currentUser } = ctx.state;
|
|
48
76
|
if (!currentUser) {
|
|
49
77
|
ctx.throw(401);
|
|
50
78
|
}
|
|
51
|
-
const
|
|
52
|
-
const
|
|
79
|
+
const schemaRepo = ctx.db.getRepository("uiSchemas");
|
|
80
|
+
const schema = await schemaRepo.getJsonSchema("nocobase-user-profile-edit-form");
|
|
81
|
+
const { fields, requiredFields } = parseProfileFormSchema(schema);
|
|
82
|
+
const userRepo = ctx.db.getRepository("users");
|
|
83
|
+
const user = await userRepo.findOne({ filter: { id: currentUser.id } });
|
|
84
|
+
for (const field of requiredFields) {
|
|
85
|
+
if (!values[field]) {
|
|
86
|
+
throw new import_sequelize.ValidationError(`${field} can not be null`, [
|
|
87
|
+
new import_sequelize.ValidationErrorItem(
|
|
88
|
+
`${field} can not be null`,
|
|
89
|
+
// @ts-ignore
|
|
90
|
+
"notNull violation",
|
|
91
|
+
field,
|
|
92
|
+
null,
|
|
93
|
+
user,
|
|
94
|
+
"is_null",
|
|
95
|
+
null,
|
|
96
|
+
null
|
|
97
|
+
)
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const result = await userRepo.update({
|
|
53
102
|
filterByTk: currentUser.id,
|
|
54
|
-
values: import_lodash.default.pick(values,
|
|
103
|
+
values: import_lodash.default.pick(values, fields)
|
|
55
104
|
});
|
|
56
105
|
ctx.body = result;
|
|
57
106
|
await next();
|
|
58
107
|
}
|
|
108
|
+
async function updateLang(ctx, next) {
|
|
109
|
+
const { appLang } = ctx.action.params.values || {};
|
|
110
|
+
const { currentUser } = ctx.state;
|
|
111
|
+
if (!currentUser) {
|
|
112
|
+
ctx.throw(401);
|
|
113
|
+
}
|
|
114
|
+
const userRepo = ctx.db.getRepository("users");
|
|
115
|
+
await userRepo.update({
|
|
116
|
+
filterByTk: currentUser.id,
|
|
117
|
+
values: {
|
|
118
|
+
appLang
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
await next();
|
|
122
|
+
}
|
|
59
123
|
const listExcludeRole = async (ctx, next) => {
|
|
60
124
|
const { roleName, page = import_actions.DEFAULT_PAGE, pageSize = import_actions.DEFAULT_PER_PAGE } = ctx.action.params;
|
|
61
125
|
const repo = ctx.db.getRepository("users");
|
|
@@ -91,8 +155,39 @@ const listExcludeRole = async (ctx, next) => {
|
|
|
91
155
|
};
|
|
92
156
|
await next();
|
|
93
157
|
};
|
|
158
|
+
const getSystemSettings = async (ctx, next) => {
|
|
159
|
+
const systemSettings = ctx.db.getRepository("systemSettings");
|
|
160
|
+
const settings = await systemSettings.findOne();
|
|
161
|
+
ctx.body = {
|
|
162
|
+
enableEditProfile: settings.get("enableEditProfile"),
|
|
163
|
+
enableChangePassword: settings.get("enableChangePassword")
|
|
164
|
+
};
|
|
165
|
+
await next();
|
|
166
|
+
};
|
|
167
|
+
const updateSystemSettings = async (ctx, next) => {
|
|
168
|
+
const { enableEditProfile, enableChangePassword } = ctx.action.params.values || {};
|
|
169
|
+
const systemSettings = ctx.db.getRepository("systemSettings");
|
|
170
|
+
const values = {};
|
|
171
|
+
if (enableEditProfile !== void 0) {
|
|
172
|
+
values["enableEditProfile"] = enableEditProfile;
|
|
173
|
+
}
|
|
174
|
+
if (enableChangePassword !== void 0) {
|
|
175
|
+
values["enableChangePassword"] = enableChangePassword;
|
|
176
|
+
}
|
|
177
|
+
if (!Object.keys(values).length) {
|
|
178
|
+
ctx.throw(400);
|
|
179
|
+
}
|
|
180
|
+
await systemSettings.update({
|
|
181
|
+
filterByTk: 1,
|
|
182
|
+
values
|
|
183
|
+
});
|
|
184
|
+
await next();
|
|
185
|
+
};
|
|
94
186
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
187
|
0 && (module.exports = {
|
|
188
|
+
getSystemSettings,
|
|
96
189
|
listExcludeRole,
|
|
97
|
-
|
|
190
|
+
updateLang,
|
|
191
|
+
updateProfile,
|
|
192
|
+
updateSystemSettings
|
|
98
193
|
});
|
|
@@ -35,6 +35,7 @@ var users_default = (0, import_database.defineCollection)({
|
|
|
35
35
|
dumpRules: {
|
|
36
36
|
group: "user"
|
|
37
37
|
},
|
|
38
|
+
migrationRules: ["schema-only", "overwrite"],
|
|
38
39
|
name: "users",
|
|
39
40
|
title: '{{t("Users")}}',
|
|
40
41
|
sortable: "sort",
|
|
@@ -109,7 +110,8 @@ var users_default = (0, import_database.defineCollection)({
|
|
|
109
110
|
uiSchema: {
|
|
110
111
|
type: "string",
|
|
111
112
|
title: '{{t("Password")}}',
|
|
112
|
-
"x-component": "Password"
|
|
113
|
+
"x-component": "Password",
|
|
114
|
+
"x-validator": { password: true }
|
|
113
115
|
}
|
|
114
116
|
},
|
|
115
117
|
{
|
|
@@ -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 { Migration } from '@nocobase/server';
|
|
10
|
+
export default class extends Migration {
|
|
11
|
+
on: string;
|
|
12
|
+
up(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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 profile_schema_exports = {};
|
|
28
|
+
__export(profile_schema_exports, {
|
|
29
|
+
default: () => profile_schema_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(profile_schema_exports);
|
|
32
|
+
var import_server = require("@nocobase/server");
|
|
33
|
+
var import_edit_form_schema = require("../profile/edit-form-schema");
|
|
34
|
+
class profile_schema_default extends import_server.Migration {
|
|
35
|
+
on = "afterLoad";
|
|
36
|
+
// 'beforeLoad' or 'afterLoad'
|
|
37
|
+
async up() {
|
|
38
|
+
const repo = this.db.getRepository("uiSchemas");
|
|
39
|
+
const adminCreateSchema = await repo.findOne({
|
|
40
|
+
filter: {
|
|
41
|
+
"x-uid": "nocobase-admin-profile-create-form"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
if (!adminCreateSchema) {
|
|
45
|
+
await repo.insert(import_edit_form_schema.adminProfileCreateFormSchema);
|
|
46
|
+
}
|
|
47
|
+
const adminEditSchema = await repo.findOne({
|
|
48
|
+
filter: {
|
|
49
|
+
"x-uid": "nocobase-admin-profile-edit-form"
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (!adminEditSchema) {
|
|
53
|
+
await repo.insert(import_edit_form_schema.adminProfileEditFormSchema);
|
|
54
|
+
}
|
|
55
|
+
const userSchema = await repo.findOne({
|
|
56
|
+
filter: {
|
|
57
|
+
"x-uid": "nocobase-user-profile-edit-form"
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
if (!userSchema) {
|
|
61
|
+
await repo.insert(import_edit_form_schema.userProfileEditFormSchema);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 { Migration } from '@nocobase/server';
|
|
10
|
+
export default class UpdatePasswordValidatorMigration extends Migration {
|
|
11
|
+
on: string;
|
|
12
|
+
up(): Promise<void>;
|
|
13
|
+
down(): Promise<void>;
|
|
14
|
+
}
|