@nocobase/plugin-users 1.4.0-alpha.20240903052847 → 1.4.0-alpha.20240906114411
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,16 @@
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"react": "18.2.0",
|
|
12
12
|
"antd": "5.12.8",
|
|
13
|
-
"@nocobase/client": "1.4.0-alpha.
|
|
13
|
+
"@nocobase/client": "1.4.0-alpha.20240906114411",
|
|
14
14
|
"@formily/react": "2.3.0",
|
|
15
15
|
"@formily/core": "2.3.0",
|
|
16
|
-
"@nocobase/plugin-acl": "1.4.0-alpha.
|
|
17
|
-
"@nocobase/utils": "1.4.0-alpha.
|
|
16
|
+
"@nocobase/plugin-acl": "1.4.0-alpha.20240906114411",
|
|
17
|
+
"@nocobase/utils": "1.4.0-alpha.20240906114411",
|
|
18
18
|
"react-i18next": "11.18.6",
|
|
19
|
-
"@nocobase/database": "1.4.0-alpha.
|
|
20
|
-
"@nocobase/server": "1.4.0-alpha.
|
|
21
|
-
"@nocobase/
|
|
22
|
-
"@nocobase/plugin-user-data-sync": "1.4.0-alpha.20240903052847",
|
|
19
|
+
"@nocobase/database": "1.4.0-alpha.20240906114411",
|
|
20
|
+
"@nocobase/server": "1.4.0-alpha.20240906114411",
|
|
21
|
+
"@nocobase/plugin-user-data-sync": "1.4.0-alpha.20240906114411",
|
|
23
22
|
"lodash": "4.17.21",
|
|
24
23
|
"@formily/shared": "2.3.0",
|
|
25
|
-
"@nocobase/actions": "1.4.0-alpha.
|
|
24
|
+
"@nocobase/actions": "1.4.0-alpha.20240906114411"
|
|
26
25
|
};
|
package/dist/server/server.js
CHANGED
|
@@ -42,7 +42,6 @@ module.exports = __toCommonJS(server_exports);
|
|
|
42
42
|
var import_database = require("@nocobase/database");
|
|
43
43
|
var import_server = require("@nocobase/server");
|
|
44
44
|
var import_utils = require("@nocobase/utils");
|
|
45
|
-
var import_path = require("path");
|
|
46
45
|
var actions = __toESM(require("./actions/users"));
|
|
47
46
|
var import_UserModel = require("./models/UserModel");
|
|
48
47
|
var import_user_data_sync_resource = require("./user-data-sync-resource");
|
|
@@ -178,28 +177,25 @@ class PluginUsersServer extends import_server.Plugin {
|
|
|
178
177
|
});
|
|
179
178
|
}
|
|
180
179
|
async load() {
|
|
181
|
-
|
|
182
|
-
this.db.addMigrations({
|
|
183
|
-
namespace: "users",
|
|
184
|
-
directory: (0, import_path.resolve)(__dirname, "migrations"),
|
|
185
|
-
context: {
|
|
186
|
-
plugin: this
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
this.app.resourcer.use(async (ctx, next) => {
|
|
180
|
+
this.app.resourceManager.use(async (ctx, next) => {
|
|
190
181
|
await next();
|
|
191
182
|
const { associatedName, resourceName, actionName, values } = ctx.action.params;
|
|
192
|
-
const cache = ctx.app.cache;
|
|
193
183
|
if (associatedName === "roles" && resourceName === "users" && ["add", "remove", "set"].includes(actionName) && (values == null ? void 0 : values.length)) {
|
|
194
|
-
|
|
195
|
-
await cache.del(`roles:${userId}`);
|
|
196
|
-
}
|
|
184
|
+
await Promise.all(values.map((userId) => this.app.emitAsync("cache:del:roles", { userId })));
|
|
197
185
|
}
|
|
198
186
|
});
|
|
199
187
|
const userDataSyncPlugin = this.app.pm.get("user-data-sync");
|
|
200
188
|
if (userDataSyncPlugin && userDataSyncPlugin.enabled) {
|
|
201
189
|
userDataSyncPlugin.resourceManager.registerResource(new import_user_data_sync_resource.UserDataSyncResource(this.db, this.app.logger));
|
|
202
190
|
}
|
|
191
|
+
this.app.db.on("users.beforeUpdate", async (model) => {
|
|
192
|
+
if (!model._changed.has("password")) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
model.set("passwordChangeTz", Date.now());
|
|
196
|
+
await this.app.emitAsync("cache:del:roles", { userId: model.get("id") });
|
|
197
|
+
await this.app.emitAsync("cache:del:auth", { userId: model.get("id") });
|
|
198
|
+
});
|
|
203
199
|
}
|
|
204
200
|
getInstallingData(options = {}) {
|
|
205
201
|
var _a;
|
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.0-alpha.
|
|
7
|
+
"version": "1.4.0-alpha.20240906114411",
|
|
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": "5cb73d3b80b4a1056d8508bf0c790b85854f12d9",
|
|
29
29
|
"keywords": [
|
|
30
30
|
"Users & permissions"
|
|
31
31
|
]
|