@nocobase/plugin-users 1.4.12 → 1.4.14
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/externalVersion.js
CHANGED
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"antd": "5.12.8",
|
|
13
|
-
"@nocobase/client": "1.4.
|
|
13
|
+
"@nocobase/client": "1.4.14",
|
|
14
14
|
"@formily/react": "2.3.0",
|
|
15
15
|
"@formily/core": "2.3.0",
|
|
16
|
-
"@nocobase/plugin-acl": "1.4.
|
|
16
|
+
"@nocobase/plugin-acl": "1.4.14",
|
|
17
17
|
"@emotion/css": "11.13.0",
|
|
18
|
-
"@nocobase/utils": "1.4.
|
|
18
|
+
"@nocobase/utils": "1.4.14",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
|
-
"@nocobase/database": "1.4.
|
|
21
|
-
"@nocobase/server": "1.4.
|
|
22
|
-
"@nocobase/plugin-user-data-sync": "1.4.
|
|
20
|
+
"@nocobase/database": "1.4.14",
|
|
21
|
+
"@nocobase/server": "1.4.14",
|
|
22
|
+
"@nocobase/plugin-user-data-sync": "1.4.14",
|
|
23
23
|
"lodash": "4.17.21",
|
|
24
24
|
"@formily/shared": "2.3.2",
|
|
25
|
-
"@nocobase/actions": "1.4.
|
|
25
|
+
"@nocobase/actions": "1.4.14"
|
|
26
26
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
"Add users": "Add users",
|
|
4
4
|
"Remove user": "Remove user",
|
|
5
5
|
"Are you sure you want to remove it?": "Are you sure you want to remove it?",
|
|
6
|
-
"Random password": "Random password"
|
|
6
|
+
"Random password": "Random password",
|
|
7
|
+
"User profile is not allowed to be edited": "User profile is not allowed to be edited"
|
|
7
8
|
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -8,4 +8,5 @@
|
|
|
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>;
|
|
@@ -37,12 +37,20 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
37
37
|
var users_exports = {};
|
|
38
38
|
__export(users_exports, {
|
|
39
39
|
listExcludeRole: () => listExcludeRole,
|
|
40
|
+
updateLang: () => updateLang,
|
|
40
41
|
updateProfile: () => updateProfile
|
|
41
42
|
});
|
|
42
43
|
module.exports = __toCommonJS(users_exports);
|
|
43
44
|
var import_actions = require("@nocobase/actions");
|
|
44
45
|
var import_lodash = __toESM(require("lodash"));
|
|
46
|
+
var import__ = require("..");
|
|
45
47
|
async function updateProfile(ctx, next) {
|
|
48
|
+
const systemSettings = ctx.db.getRepository("systemSettings");
|
|
49
|
+
const settings = await systemSettings.findOne();
|
|
50
|
+
const enableEditProfile = settings.get("enableEditProfile");
|
|
51
|
+
if (enableEditProfile === false) {
|
|
52
|
+
ctx.throw(403, ctx.t("User profile is not allowed to be edited", { ns: import__.namespace }));
|
|
53
|
+
}
|
|
46
54
|
const values = ctx.action.params.values || {};
|
|
47
55
|
const { currentUser } = ctx.state;
|
|
48
56
|
if (!currentUser) {
|
|
@@ -51,11 +59,26 @@ async function updateProfile(ctx, next) {
|
|
|
51
59
|
const UserRepo = ctx.db.getRepository("users");
|
|
52
60
|
const result = await UserRepo.update({
|
|
53
61
|
filterByTk: currentUser.id,
|
|
54
|
-
values: import_lodash.default.pick(values, ["nickname", "username", "email", "phone"
|
|
62
|
+
values: import_lodash.default.pick(values, ["nickname", "username", "email", "phone"])
|
|
55
63
|
});
|
|
56
64
|
ctx.body = result;
|
|
57
65
|
await next();
|
|
58
66
|
}
|
|
67
|
+
async function updateLang(ctx, next) {
|
|
68
|
+
const { appLang } = ctx.action.params.values || {};
|
|
69
|
+
const { currentUser } = ctx.state;
|
|
70
|
+
if (!currentUser) {
|
|
71
|
+
ctx.throw(401);
|
|
72
|
+
}
|
|
73
|
+
const userRepo = ctx.db.getRepository("users");
|
|
74
|
+
await userRepo.update({
|
|
75
|
+
filterByTk: currentUser.id,
|
|
76
|
+
values: {
|
|
77
|
+
appLang
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
await next();
|
|
81
|
+
}
|
|
59
82
|
const listExcludeRole = async (ctx, next) => {
|
|
60
83
|
const { roleName, page = import_actions.DEFAULT_PAGE, pageSize = import_actions.DEFAULT_PER_PAGE } = ctx.action.params;
|
|
61
84
|
const repo = ctx.db.getRepository("users");
|
|
@@ -94,5 +117,6 @@ const listExcludeRole = async (ctx, next) => {
|
|
|
94
117
|
// Annotate the CommonJS export names for ESM import in node:
|
|
95
118
|
0 && (module.exports = {
|
|
96
119
|
listExcludeRole,
|
|
120
|
+
updateLang,
|
|
97
121
|
updateProfile
|
|
98
122
|
});
|
package/dist/server/server.js
CHANGED
|
@@ -169,7 +169,7 @@ class PluginUsersServer extends import_server.Plugin {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
});
|
|
172
|
-
const loggedInActions = ["updateProfile"];
|
|
172
|
+
const loggedInActions = ["updateProfile", "updateLang"];
|
|
173
173
|
loggedInActions.forEach((action) => this.app.acl.allow("users", action, "loggedIn"));
|
|
174
174
|
this.app.acl.registerSnippet({
|
|
175
175
|
name: `pm.${this.name}`,
|
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": "1.4.
|
|
7
|
+
"version": "1.4.14",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/users",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@nocobase/test": "1.x",
|
|
26
26
|
"@nocobase/utils": "1.x"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ddf6d0441915b7e2c9f34d453a350d64e016953e",
|
|
29
29
|
"keywords": [
|
|
30
30
|
"Users & permissions"
|
|
31
31
|
]
|