@nocobase/plugin-departments 2.1.0-beta.11 → 2.1.0-beta.12
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
|
@@ -8,23 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-beta.
|
|
11
|
+
"@nocobase/client": "2.1.0-beta.12",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"@formily/react": "2.3.7",
|
|
14
14
|
"@formily/core": "2.3.7",
|
|
15
|
-
"@nocobase/utils": "2.1.0-beta.
|
|
16
|
-
"@nocobase/plugin-acl": "2.1.0-beta.
|
|
15
|
+
"@nocobase/utils": "2.1.0-beta.12",
|
|
16
|
+
"@nocobase/plugin-acl": "2.1.0-beta.12",
|
|
17
17
|
"react-i18next": "11.18.6",
|
|
18
|
-
"@nocobase/database": "2.1.0-beta.
|
|
18
|
+
"@nocobase/database": "2.1.0-beta.12",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
|
-
"@nocobase/plugin-user-data-sync": "2.1.0-beta.
|
|
21
|
-
"@nocobase/cache": "2.1.0-beta.
|
|
22
|
-
"@nocobase/server": "2.1.0-beta.
|
|
23
|
-
"@nocobase/data-source-manager": "2.1.0-beta.
|
|
24
|
-
"@nocobase/plugin-error-handler": "2.1.0-beta.
|
|
20
|
+
"@nocobase/plugin-user-data-sync": "2.1.0-beta.12",
|
|
21
|
+
"@nocobase/cache": "2.1.0-beta.12",
|
|
22
|
+
"@nocobase/server": "2.1.0-beta.12",
|
|
23
|
+
"@nocobase/data-source-manager": "2.1.0-beta.12",
|
|
24
|
+
"@nocobase/plugin-error-handler": "2.1.0-beta.12",
|
|
25
25
|
"antd": "5.24.2",
|
|
26
26
|
"@ant-design/icons": "5.6.1",
|
|
27
27
|
"@formily/shared": "2.3.7",
|
|
28
28
|
"@emotion/css": "11.13.0",
|
|
29
|
-
"@nocobase/actions": "2.1.0-beta.
|
|
29
|
+
"@nocobase/actions": "2.1.0-beta.12"
|
|
30
30
|
};
|
|
@@ -17,4 +17,3 @@
|
|
|
17
17
|
import { Context, Next } from '@nocobase/actions';
|
|
18
18
|
export declare const listExcludeDept: (ctx: Context, next: Next) => Promise<void>;
|
|
19
19
|
export declare const setDepartments: (ctx: Context, next: Next) => Promise<void>;
|
|
20
|
-
export declare const setMainDepartment: (ctx: Context, next: Next) => Promise<void>;
|
|
@@ -27,8 +27,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
27
27
|
var users_exports = {};
|
|
28
28
|
__export(users_exports, {
|
|
29
29
|
listExcludeDept: () => listExcludeDept,
|
|
30
|
-
setDepartments: () => setDepartments
|
|
31
|
-
setMainDepartment: () => setMainDepartment
|
|
30
|
+
setDepartments: () => setDepartments
|
|
32
31
|
});
|
|
33
32
|
module.exports = __toCommonJS(users_exports);
|
|
34
33
|
var import_actions = require("@nocobase/actions");
|
|
@@ -102,36 +101,8 @@ const setDepartments = async (ctx, next) => {
|
|
|
102
101
|
});
|
|
103
102
|
await next();
|
|
104
103
|
};
|
|
105
|
-
const setMainDepartment = async (ctx, next) => {
|
|
106
|
-
const { userId, departmentId } = ctx.action.params.values || {};
|
|
107
|
-
const repo = ctx.db.getRepository("users");
|
|
108
|
-
const throughRepo = ctx.db.getRepository("departmentsUsers");
|
|
109
|
-
await ctx.db.sequelize.transaction(async (t) => {
|
|
110
|
-
await repo.update({
|
|
111
|
-
filterByTk: userId,
|
|
112
|
-
values: { mainDepartmentId: departmentId },
|
|
113
|
-
transaction: t
|
|
114
|
-
});
|
|
115
|
-
const existingAssoc = await throughRepo.findOne({
|
|
116
|
-
filter: { userId, departmentId },
|
|
117
|
-
transaction: t
|
|
118
|
-
});
|
|
119
|
-
if (!existingAssoc) {
|
|
120
|
-
await throughRepo.create({
|
|
121
|
-
values: {
|
|
122
|
-
userId,
|
|
123
|
-
departmentId,
|
|
124
|
-
isOwner: false
|
|
125
|
-
},
|
|
126
|
-
transaction: t
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
await next();
|
|
131
|
-
};
|
|
132
104
|
// Annotate the CommonJS export names for ESM import in node:
|
|
133
105
|
0 && (module.exports = {
|
|
134
106
|
listExcludeDept,
|
|
135
|
-
setDepartments
|
|
136
|
-
setMainDepartment
|
|
107
|
+
setDepartments
|
|
137
108
|
});
|
package/dist/server/plugin.js
CHANGED
|
@@ -54,12 +54,11 @@ class PluginDepartmentsServer extends import_server.Plugin {
|
|
|
54
54
|
this.registerErrorHandler();
|
|
55
55
|
this.app.resourceManager.registerActionHandlers({
|
|
56
56
|
"users:listExcludeDept": import_users.listExcludeDept,
|
|
57
|
-
"users:setMainDepartment": import_users.setMainDepartment,
|
|
58
57
|
"departments:aggregateSearch": import_departments.aggregateSearch,
|
|
59
58
|
"departments:setOwner": import_departments.setOwner,
|
|
60
59
|
"departments:removeOwner": import_departments.removeOwner
|
|
61
60
|
});
|
|
62
|
-
this.app.acl.allow("users", ["
|
|
61
|
+
this.app.acl.allow("users", ["listExcludeDept"], "loggedIn");
|
|
63
62
|
this.app.acl.registerSnippet({
|
|
64
63
|
name: `pm.${this.name}`,
|
|
65
64
|
actions: [
|
|
@@ -67,7 +66,6 @@ class PluginDepartmentsServer extends import_server.Plugin {
|
|
|
67
66
|
"roles:list",
|
|
68
67
|
"users:list",
|
|
69
68
|
"users:listExcludeDept",
|
|
70
|
-
"users:setMainDepartment",
|
|
71
69
|
"users.departments:*",
|
|
72
70
|
"roles.departments:*",
|
|
73
71
|
"departments.members:*"
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"description": "Organize users by departments, set hierarchical relationships, link roles to control permissions, and use departments as variables in workflows and expressions.",
|
|
7
7
|
"description.ru-RU": "Организация пользователей по подразделениям, установление иерархических связей, привязка ролей для управления правами и использование подразделений в качестве переменных в рабочих процессах и выражениях.",
|
|
8
8
|
"description.zh-CN": "以部门来组织用户,设定上下级关系,绑定角色控制权限,并支持作为变量用于工作流和表达式。",
|
|
9
|
-
"version": "2.1.0-beta.
|
|
9
|
+
"version": "2.1.0-beta.12",
|
|
10
10
|
"main": "dist/server/index.js",
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"@nocobase/actions": "2.x",
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"keywords": [
|
|
19
19
|
"Users & permissions"
|
|
20
20
|
],
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "25cee9643f42f850afc4adc33c55a56850ac730d",
|
|
22
22
|
"license": "Apache-2.0"
|
|
23
23
|
}
|