@nocobase/plugin-users 0.21.0-alpha.9 → 1.0.0-alpha.10

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 (54) hide show
  1. package/dist/client/PasswordField.d.ts +8 -0
  2. package/dist/client/RoleUsersManager.d.ts +8 -0
  3. package/dist/client/UserRolesField.d.ts +8 -0
  4. package/dist/client/UsersManagement.d.ts +8 -0
  5. package/dist/client/hooks.d.ts +8 -0
  6. package/dist/client/index.d.ts +8 -0
  7. package/dist/client/index.js +9 -0
  8. package/dist/client/locale.d.ts +8 -0
  9. package/dist/client/schemas/users.d.ts +8 -0
  10. package/dist/client/utils.d.ts +8 -0
  11. package/dist/externalVersion.js +17 -7
  12. package/dist/index.d.ts +8 -0
  13. package/dist/index.js +9 -0
  14. package/dist/server/actions/users.d.ts +8 -0
  15. package/dist/server/actions/users.js +22 -2
  16. package/dist/server/collections/users.d.ts +8 -0
  17. package/dist/server/collections/users.js +39 -0
  18. package/dist/server/index.d.ts +8 -0
  19. package/dist/server/index.js +9 -0
  20. package/dist/server/locale/en-US.d.ts +8 -0
  21. package/dist/server/locale/en-US.js +9 -0
  22. package/dist/server/locale/es-ES.d.ts +8 -0
  23. package/dist/server/locale/es-ES.js +9 -0
  24. package/dist/server/locale/fr-FR.d.ts +8 -0
  25. package/dist/server/locale/fr-FR.js +9 -0
  26. package/dist/server/locale/index.d.ts +8 -0
  27. package/dist/server/locale/index.js +9 -0
  28. package/dist/server/locale/ja-JP.d.ts +8 -0
  29. package/dist/server/locale/ja-JP.js +9 -0
  30. package/dist/server/locale/pt-BR.d.ts +8 -0
  31. package/dist/server/locale/pt-BR.js +9 -0
  32. package/dist/server/locale/zh-CN.d.ts +8 -0
  33. package/dist/server/locale/zh-CN.js +9 -0
  34. package/dist/server/migrations/20220818072639-add-users-phone-constraint.d.ts +8 -0
  35. package/dist/server/migrations/20220818072639-add-users-phone-constraint.js +9 -0
  36. package/dist/server/migrations/20220818072639-add-users-phone.d.ts +8 -0
  37. package/dist/server/migrations/20220818072639-add-users-phone.js +9 -0
  38. package/dist/server/migrations/20230802170800-add-username-constraint.d.ts +8 -0
  39. package/dist/server/migrations/20230802170800-add-username-constraint.js +9 -0
  40. package/dist/server/migrations/20230802170800-add-username.d.ts +8 -0
  41. package/dist/server/migrations/20230802170800-add-username.js +9 -0
  42. package/dist/server/migrations/20230802183100-update-username.d.ts +8 -0
  43. package/dist/server/migrations/20230802183100-update-username.js +9 -0
  44. package/dist/server/migrations/20230908164036-update-username-interface.d.ts +8 -0
  45. package/dist/server/migrations/20230908164036-update-username-interface.js +9 -0
  46. package/dist/server/migrations/20240410152410-update-phone-interface.d.ts +8 -0
  47. package/dist/server/migrations/20240410152410-update-phone-interface.js +9 -0
  48. package/dist/server/migrations/20240418101937-update-system-fields.d.ts +14 -0
  49. package/dist/server/migrations/20240418101937-update-system-fields.js +146 -0
  50. package/dist/server/models/UserModel.d.ts +8 -0
  51. package/dist/server/models/UserModel.js +9 -0
  52. package/dist/server/server.d.ts +8 -0
  53. package/dist/server/server.js +37 -2
  54. package/package.json +11 -11
@@ -1,2 +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
+ */
1
9
  import React from 'react';
2
10
  export declare const PasswordField: React.FC;
@@ -1,2 +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
+ */
1
9
  import React from 'react';
2
10
  export declare const RoleUsersManager: React.FC;
@@ -1,2 +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
+ */
1
9
  import React from 'react';
2
10
  export declare const UserRolesField: React.FC;
@@ -1,2 +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
+ */
1
9
  import React from 'react';
2
10
  export declare const UsersManagement: React.FC;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  export declare const useFilterActionProps: () => {
2
10
  options: any;
3
11
  onSubmit(values: any): any;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Plugin } from '@nocobase/client';
2
10
  declare class PluginUsersClient extends Plugin {
3
11
  load(): Promise<void>;
@@ -1 +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
+
1
10
  (function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("react"),require("@formily/shared"),require("antd"),require("@formily/react"),require("react-i18next"),require("@nocobase/plugin-acl/client")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","react","@formily/shared","antd","@formily/react","react-i18next","@nocobase/plugin-acl/client"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r["@nocobase/plugin-users"]={},r["@nocobase/client"],r.jsxRuntime,r.react,r["@formily/shared"],r.antd,r["@formily/react"],r["react-i18next"],r["@nocobase/plugin-acl"]))})(this,function(r,e,t,p,f,d,C,v,a){"use strict";var j=Object.defineProperty,N=Object.defineProperties;var L=Object.getOwnPropertyDescriptors;var S=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var D=(r,e,t)=>e in r?j(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))_.call(e,t)&&D(r,t,e[t]);if(S)for(var t of S(e))$.call(e,t)&&D(r,t,e[t]);return r},b=(r,e)=>N(r,L(e));var h=(r,e,t)=>new Promise((p,f)=>{var d=a=>{try{v(t.next(a))}catch(y){f(y)}},C=a=>{try{v(t.throw(a))}catch(y){f(y)}},v=a=>a.done?p(a.value):Promise.resolve(a.value).then(d,C);v((t=t.apply(r,e)).next())});const y={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","x-validator":"phone",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"}}}}]},T={type:"object",properties:{block1:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:y,resourceName:"users",request:{resource:"users",action:"list",params:{pageSize:50,appends:[]}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{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"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete users')}}",content:"{{t('Are you sure you want to delete it?')}}"},icon:"DeleteOutlined"}},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":"Form",title:'{{t("Add user")}}',properties:{nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem",required:!1},password:{"x-component":"CollectionField","x-decorator":"FormItem",required:!0},roles:{"x-component":"CollectionField","x-collection-field":"users.roles","x-decorator":"FormItem"},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 }}"}}}}}}}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{nickname:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{username:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{email:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Roles")}}',properties:{roles:{type:"array","x-component":"UserRolesField"}}},column5:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",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","x-decorator":"Form","x-decorator-props":{useValues:i=>{const o=e.useRecord(),n=e.useRequest(()=>Promise.resolve({data:o}),b(g({},i),{manual:!0})),s=e.useActionContext();return p.useEffect(()=>{s.visible&&n.run()},[s.visible]),n}},title:'{{t("Edit profile")}}',properties:{nickname:{"x-component":"CollectionField","x-decorator":"FormItem"},username:{"x-component":"CollectionField","x-decorator":"FormItem"},email:{title:'{{t("Email")}}',"x-component":"Input","x-validator":"email","x-decorator":"FormItem",required:!1},phone:{title:'{{t("Phone")}}',"x-component":"Input","x-validator":"phone","x-decorator":"FormItem",required:!1},roles:{"x-component":"CollectionField","x-decorator":"FormItem","x-collection-field":"users.roles"},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 }}"}}}}}}}},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":"Form",title:'{{t("Change password")}}',properties:{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-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},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?')}}"},useAction:"{{cm.useDestroyAction}}"}}}}}}}}}}}},P=()=>({type:"void",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{[f.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"},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 }}"}}}}}}}}}}}},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 }}"}}}}}}}}}});function A(){return v.useTranslation(["users","client"],{nsMode:"fallback"})}const I=()=>{const{t:i}=A();return(C.useField().value||[]).map(n=>t.jsx(d.Tag,{children:C.Schema.compile(n.title,{t:i})},n.name))},w=()=>{var s,c;const i=p.useContext(e.CollectionContext),o=e.useFilterFieldOptions(i.fields),n=e.useResourceActionContext();return e.useFilterFieldProps({options:o,params:((c=(s=n.state)==null?void 0:s.params)==null?void 0:c[0])||n.params,service:n})},U=(i=10)=>{const o="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n="abcdefghijklmnopqrstuvwxyz",s="0123456789",c="!#$%^&*-_+=",x=o+n+s+c,u=new Uint32Array(i);crypto.getRandomValues(u);let l="";l+=o.charAt(u[0]%o.length),l+=n.charAt(u[1]%n.length),l+=s.charAt(u[2]%s.length),l+=c.charAt(u[3]%c.length);for(let m=4;m<i;m++){const F=u[m]%x.length;l+=x.charAt(F)}return l=l[0]+l.slice(1).split("").sort(()=>Math.random()-.5).join(""),l},R=()=>{const{t:i}=A(),o=C.useField(),[n,s]=p.useState(!1),c=e.useActionContext();return p.useEffect(()=>{c.visible||o.reset()},[o,c.visible]),t.jsxs(d.Row,{gutter:10,children:[t.jsx(d.Col,{span:18,children:t.jsx(e.Password,{checkStrength:!0,visibilityToggle:{visible:n,onVisibleChange:s},value:o.value,onChange:x=>o.setValue(x.target.value),autoComplete:"off"})}),t.jsx(d.Col,{span:4,children:t.jsx(d.Button,{onClick:()=>{o.setValue(U()),s(!0)},children:i("Random password")})})]})},k=()=>{const{t:i}=A(),o=e.useSchemaComponentContext();return t.jsx(e.SchemaComponentContext.Provider,{value:b(g({},o),{designable:!1}),children:t.jsx(d.Card,{children:t.jsx(e.SchemaComponent,{schema:T,scope:{t:i,useFilterActionProps:w},components:{UserRolesField:I,PasswordField:R}})})})},q=()=>{const i=e.useAPIClient(),{role:o}=p.useContext(a.RolesManagerContext),n=e.useRecord(),{refresh:s}=e.useResourceActionContext();return{run(){return h(this,null,function*(){yield i.resource("roles.users",o==null?void 0:o.name).remove({values:[n.id]}),s()})}}},M=()=>{const{t:i}=A(),{message:o}=d.App.useApp(),n=e.useAPIClient(),{state:s,setState:c,refresh:x}=e.useResourceActionContext(),{role:u}=p.useContext(a.RolesManagerContext);return{run(){return h(this,null,function*(){const m=s==null?void 0:s.selectedRowKeys;if(!(m!=null&&m.length)){o.warning(i("Please select users"));return}yield n.resource("roles.users",u==null?void 0:u.name).remove({values:m}),c==null||c({selectedRowKeys:[]}),x()})}}},O=i=>{const{role:o}=p.useContext(a.RolesManagerContext);return t.jsx(e.ResourceActionProvider,{collection:y,request:{resource:"users",action:"listExcludeRole",params:{roleName:o==null?void 0:o.name}},children:i.children})},V=()=>{const{t:i}=A(),{role:o}=p.useContext(a.RolesManagerContext),n=e.useRequest({resource:"roles.users",resourceOf:o==null?void 0:o.name,action:"list"},{ready:!!o});p.useEffect(()=>{n.run()},[o]);const s=p.useRef([]),c=(l,m)=>{s.current=m},x=()=>{const{role:l}=p.useContext(a.RolesManagerContext),m=e.useAPIClient(),{setVisible:F}=e.useActionContext(),{refresh:E}=e.useResourceActionContext();return{run(){return h(this,null,function*(){yield m.resource("roles.users",l==null?void 0:l.name).add({values:s.current.map(K=>K.id)}),s.current=[],F(!1),E()})}}},u=p.useMemo(()=>P(),[o]);return t.jsx(e.ResourceActionContext.Provider,{value:g({},n),children:t.jsx(e.CollectionProvider_deprecated,{collection:y,children:t.jsx(e.SchemaComponent,{schema:u,components:{RoleUsersProvider:O},scope:{useBulkRemoveUsers:M,useRemoveUser:q,handleSelectRoleUsers:c,useAddRoleUsers:x,useFilterActionProps:w,t:i}})})})};class B extends e.Plugin{load(){return h(this,null,function*(){this.app.pluginSettingsManager.add("users-permissions",{title:e.tval("Users & Permissions",{ns:"users"}),icon:"TeamOutlined"}),this.app.pluginSettingsManager.add("users-permissions.users",{title:e.tval("Users"),icon:"UserOutlined",Component:k,aclSnippet:"pm.users"}),this.app.pm.get(a).rolesManager.add("users",{title:e.tval("Users"),Component:V})})}}r.default=B,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1 +1,9 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  export declare function useUsersTranslation(): import("react-i18next").UseTranslationResponse<("users" | "client")[], undefined>;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { ISchema } from '@formily/react';
2
10
  export declare const userCollection: {
3
11
  name: string;
@@ -1 +1,9 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  export declare const generatePassword: (length?: number) => string;
@@ -1,15 +1,25 @@
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
+
1
10
  module.exports = {
2
11
  "react": "18.2.0",
3
12
  "antd": "5.12.8",
4
- "@nocobase/client": "0.21.0-alpha.9",
13
+ "@nocobase/client": "1.0.0-alpha.10",
5
14
  "@formily/react": "2.3.0",
6
15
  "@formily/core": "2.3.0",
7
- "@nocobase/plugin-acl": "0.21.0-alpha.9",
16
+ "@nocobase/plugin-acl": "1.0.0-alpha.10",
8
17
  "react-i18next": "11.18.6",
9
- "@nocobase/database": "0.21.0-alpha.9",
10
- "@nocobase/server": "0.21.0-alpha.9",
11
- "@nocobase/utils": "0.21.0-alpha.9",
12
- "@nocobase/cache": "0.21.0-alpha.9",
18
+ "@nocobase/database": "1.0.0-alpha.10",
19
+ "@nocobase/server": "1.0.0-alpha.10",
20
+ "@nocobase/utils": "1.0.0-alpha.10",
21
+ "@nocobase/cache": "1.0.0-alpha.10",
13
22
  "@formily/shared": "2.3.0",
14
- "@nocobase/actions": "0.21.0-alpha.9"
23
+ "@nocobase/actions": "1.0.0-alpha.10",
24
+ "lodash": "4.17.21"
15
25
  };
package/dist/index.d.ts CHANGED
@@ -1,2 +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
+ */
1
9
  export * from './server';
2
10
  export { default } from './server';
package/dist/index.js CHANGED
@@ -1,3 +1,12 @@
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
+
1
10
  var __create = Object.create;
2
11
  var __defProp = Object.defineProperty;
3
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Context, Next } from '@nocobase/actions';
2
10
  export declare function updateProfile(ctx: Context, next: Next): Promise<void>;
3
11
  export declare const listExcludeRole: (ctx: Context, next: Next) => Promise<void>;
@@ -1,6 +1,17 @@
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;
1
11
  var __defProp = Object.defineProperty;
2
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
13
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
4
15
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
16
  var __export = (target, all) => {
6
17
  for (var name in all)
@@ -14,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
14
25
  }
15
26
  return to;
16
27
  };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
17
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
37
  var users_exports = {};
19
38
  __export(users_exports, {
@@ -22,8 +41,9 @@ __export(users_exports, {
22
41
  });
23
42
  module.exports = __toCommonJS(users_exports);
24
43
  var import_actions = require("@nocobase/actions");
44
+ var import_lodash = __toESM(require("lodash"));
25
45
  async function updateProfile(ctx, next) {
26
- const { values } = ctx.action.params;
46
+ const values = ctx.action.params.values || {};
27
47
  const { currentUser } = ctx.state;
28
48
  if (!currentUser) {
29
49
  ctx.throw(401);
@@ -31,7 +51,7 @@ async function updateProfile(ctx, next) {
31
51
  const UserRepo = ctx.db.getRepository("users");
32
52
  const result = await UserRepo.update({
33
53
  filterByTk: currentUser.id,
34
- values
54
+ values: import_lodash.default.pick(values, ["nickname", "username", "email", "phone", "systemSettings", "appLang"])
35
55
  });
36
56
  ctx.body = result;
37
57
  await next();
@@ -1,2 +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
+ */
1
9
  declare const _default: import("@nocobase/database").CollectionOptions;
2
10
  export default _default;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -117,6 +126,36 @@ var users_default = (0, import_database.defineCollection)({
117
126
  type: "json",
118
127
  name: "systemSettings",
119
128
  defaultValue: {}
129
+ },
130
+ {
131
+ uiSchema: {
132
+ "x-component-props": {
133
+ dateFormat: "YYYY-MM-DD"
134
+ },
135
+ type: "datetime",
136
+ title: '{{t("Created at")}}',
137
+ "x-component": "DatePicker",
138
+ "x-read-pretty": true
139
+ },
140
+ name: "createdAt",
141
+ type: "date",
142
+ field: "createdAt",
143
+ interface: "createdAt"
144
+ },
145
+ {
146
+ uiSchema: {
147
+ "x-component-props": {
148
+ dateFormat: "YYYY-MM-DD"
149
+ },
150
+ type: "datetime",
151
+ title: '{{t("Last updated at")}}',
152
+ "x-component": "DatePicker",
153
+ "x-read-pretty": true
154
+ },
155
+ name: "updatedAt",
156
+ type: "date",
157
+ field: "updatedAt",
158
+ interface: "updatedAt"
120
159
  }
121
160
  ]
122
161
  });
@@ -1,2 +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
+ */
1
9
  export { default } from './server';
2
10
  export declare const namespace: string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __create = Object.create;
2
11
  var __defProp = Object.defineProperty;
3
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  declare const _default: {
2
10
  'The email is incorrect, please re-enter': string;
3
11
  'Please fill in your email address': string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  declare const _default: {
2
10
  "The email is incorrect, please re-enter": string;
3
11
  "Please fill in your email address": string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  declare const _default: {
2
10
  'The email is incorrect, please re-enter': string;
3
11
  'Please fill in your email address': string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  export { default as enUS } from './en-US';
2
10
  export { default as zhCN } from './zh-CN';
3
11
  export { default as ptBR } from './pt-BR';
@@ -1,3 +1,12 @@
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
+
1
10
  var __create = Object.create;
2
11
  var __defProp = Object.defineProperty;
3
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  declare const _default: {
2
10
  'Please fill in your email address': string;
3
11
  'The password is incorrect, please re-enter': string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  declare const _default: {
2
10
  'The email is incorrect, please re-enter': string;
3
11
  'Please fill in your email address': string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  declare const _default: {
2
10
  'The email is incorrect, please re-enter': string;
3
11
  'Please fill in your email address': string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Migration } from '@nocobase/server';
2
10
  export default class AddUsersPhoneMigration extends Migration {
3
11
  on: string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Migration } from '@nocobase/server';
2
10
  export default class AddUsersPhoneMigration extends Migration {
3
11
  appVersion: string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Migration } from '@nocobase/server';
2
10
  export default class AddUserNameMigration extends Migration {
3
11
  on: string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Migration } from '@nocobase/server';
2
10
  export default class AddUserNameMigration extends Migration {
3
11
  appVersion: string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Migration } from '@nocobase/server';
2
10
  export default class UpdateUserNameMigration extends Migration {
3
11
  appVersion: string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Migration } from '@nocobase/server';
2
10
  export default class UpdateUserNameInterfaceMigration extends Migration {
3
11
  appVersion: string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Migration } from '@nocobase/server';
2
10
  export default class extends Migration {
3
11
  on: string;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -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 extends Migration {
11
+ on: string;
12
+ appVersion: string;
13
+ up(): Promise<void>;
14
+ }
@@ -0,0 +1,146 @@
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 update_system_fields_exports = {};
28
+ __export(update_system_fields_exports, {
29
+ default: () => update_system_fields_default
30
+ });
31
+ module.exports = __toCommonJS(update_system_fields_exports);
32
+ var import_server = require("@nocobase/server");
33
+ class update_system_fields_default extends import_server.Migration {
34
+ on = "afterLoad";
35
+ // 'beforeLoad' or 'afterLoad'
36
+ appVersion = "<0.21.0-alpha.11";
37
+ async up() {
38
+ const Field = this.context.db.getRepository("fields");
39
+ const createdByField = await Field.findOne({
40
+ filter: {
41
+ name: "createdBy",
42
+ collectionName: "users",
43
+ interface: null
44
+ }
45
+ });
46
+ if (createdByField) {
47
+ await createdByField.update({
48
+ interface: "createdBy",
49
+ options: {
50
+ ...createdByField.options,
51
+ uiSchema: {
52
+ type: "object",
53
+ title: '{{t("Created by")}}',
54
+ "x-component": "AssociationField",
55
+ "x-component-props": {
56
+ fieldNames: {
57
+ value: "id",
58
+ label: "nickname"
59
+ }
60
+ },
61
+ "x-read-pretty": true
62
+ }
63
+ }
64
+ });
65
+ }
66
+ const updatedByField = await Field.findOne({
67
+ filter: {
68
+ name: "updatedBy",
69
+ collectionName: "users",
70
+ interface: null
71
+ }
72
+ });
73
+ if (updatedByField) {
74
+ await updatedByField.update({
75
+ interface: "updatedBy",
76
+ options: {
77
+ ...updatedByField.options,
78
+ uiSchema: {
79
+ type: "object",
80
+ title: '{{t("Last updated by")}}',
81
+ "x-component": "AssociationField",
82
+ "x-component-props": {
83
+ fieldNames: {
84
+ value: "id",
85
+ label: "nickname"
86
+ }
87
+ },
88
+ "x-read-pretty": true
89
+ }
90
+ }
91
+ });
92
+ }
93
+ const createdAtField = await Field.count({
94
+ filter: {
95
+ name: "createdAt",
96
+ collectionName: "users"
97
+ }
98
+ });
99
+ if (!createdAtField) {
100
+ await Field.create({
101
+ values: {
102
+ collectionName: "users",
103
+ uiSchema: {
104
+ "x-component-props": {
105
+ dateFormat: "YYYY-MM-DD"
106
+ },
107
+ type: "datetime",
108
+ title: '{{t("Created at")}}',
109
+ "x-component": "DatePicker",
110
+ "x-read-pretty": true
111
+ },
112
+ name: "createdAt",
113
+ field: "createdAt",
114
+ type: "date",
115
+ interface: "createdAt"
116
+ }
117
+ });
118
+ }
119
+ const updatedAtField = await Field.count({
120
+ filter: {
121
+ name: "updatedAt",
122
+ collectionName: "users"
123
+ }
124
+ });
125
+ if (!updatedAtField) {
126
+ await Field.create({
127
+ values: {
128
+ collectionName: "users",
129
+ uiSchema: {
130
+ "x-component-props": {
131
+ dateFormat: "YYYY-MM-DD"
132
+ },
133
+ type: "datetime",
134
+ title: '{{t("Last updated at")}}',
135
+ "x-component": "DatePicker",
136
+ "x-read-pretty": true
137
+ },
138
+ name: "updatedAt",
139
+ field: "updatedAt",
140
+ type: "date",
141
+ interface: "updatedAt"
142
+ }
143
+ });
144
+ }
145
+ }
146
+ }
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Model } from '@nocobase/database';
2
10
  export declare class UserModel extends Model {
3
11
  desensitize(): UserModel;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
1
9
  import { Plugin } from '@nocobase/server';
2
10
  export default class PluginUsersServer extends Plugin {
3
11
  beforeLoad(): Promise<void>;
@@ -1,3 +1,12 @@
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
+
1
10
  var __create = Object.create;
2
11
  var __defProp = Object.defineProperty;
3
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -98,7 +107,20 @@ class PluginUsersServer extends import_server.Plugin {
98
107
  type: "belongsTo",
99
108
  target: "users",
100
109
  foreignKey: "createdById",
101
- targetKey: "id"
110
+ targetKey: "id",
111
+ uiSchema: {
112
+ type: "object",
113
+ title: '{{t("Created by")}}',
114
+ "x-component": "AssociationField",
115
+ "x-component-props": {
116
+ fieldNames: {
117
+ value: "id",
118
+ label: "nickname"
119
+ }
120
+ },
121
+ "x-read-pretty": true
122
+ },
123
+ interface: "createdBy"
102
124
  });
103
125
  }
104
126
  if (updatedBy === true) {
@@ -113,7 +135,20 @@ class PluginUsersServer extends import_server.Plugin {
113
135
  type: "belongsTo",
114
136
  target: "users",
115
137
  foreignKey: "updatedById",
116
- targetKey: "id"
138
+ targetKey: "id",
139
+ uiSchema: {
140
+ type: "object",
141
+ title: '{{t("Last updated by")}}',
142
+ "x-component": "AssociationField",
143
+ "x-component-props": {
144
+ fieldNames: {
145
+ value: "id",
146
+ label: "nickname"
147
+ }
148
+ },
149
+ "x-read-pretty": true
150
+ },
151
+ interface: "updatedBy"
117
152
  });
118
153
  }
119
154
  });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "用户",
5
5
  "description": "Provides basic user model, as well as created by and updated by fields.",
6
6
  "description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。",
7
- "version": "0.21.0-alpha.9",
7
+ "version": "1.0.0-alpha.10",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/users",
@@ -14,17 +14,17 @@
14
14
  "jsonwebtoken": "^8.5.1"
15
15
  },
16
16
  "peerDependencies": {
17
- "@nocobase/actions": "0.x",
18
- "@nocobase/client": "0.x",
19
- "@nocobase/database": "0.x",
20
- "@nocobase/plugin-acl": "0.x",
21
- "@nocobase/plugin-auth": "0.x",
22
- "@nocobase/resourcer": "0.x",
23
- "@nocobase/server": "0.x",
24
- "@nocobase/test": "0.x",
25
- "@nocobase/utils": "0.x"
17
+ "@nocobase/actions": "1.x",
18
+ "@nocobase/client": "1.x",
19
+ "@nocobase/database": "1.x",
20
+ "@nocobase/plugin-acl": "1.x",
21
+ "@nocobase/plugin-auth": "1.x",
22
+ "@nocobase/resourcer": "1.x",
23
+ "@nocobase/server": "1.x",
24
+ "@nocobase/test": "1.x",
25
+ "@nocobase/utils": "1.x"
26
26
  },
27
- "gitHead": "a6fe6c4ee532c04e5a50ec777bf76436ca624cbd",
27
+ "gitHead": "39c634c88f835f8eadedf72ca11a9fb3323a50f8",
28
28
  "keywords": [
29
29
  "Users & permissions"
30
30
  ]