@nocobase/plugin-acl 1.2.13-alpha → 1.3.0-alpha.20240710084543
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/package.json +2 -2
- package/dist/client/NewRole.d.ts +0 -10
- package/dist/client/RolesManagement.d.ts +0 -10
- package/dist/client/RolesManagerProvider.d.ts +0 -13
- package/dist/client/RolesMenu.d.ts +0 -15
- package/dist/client/hooks/load-more-observer.d.ts +0 -15
- package/dist/client/index.d.ts +0 -16
- package/dist/client/index.js +0 -18
- package/dist/client/locale.d.ts +0 -9
- package/dist/client/permissions/ActionPermissions.d.ts +0 -12
- package/dist/client/permissions/AvailableActions.d.ts +0 -11
- package/dist/client/permissions/GeneralPermissions.d.ts +0 -12
- package/dist/client/permissions/MenuItemsProvider.d.ts +0 -12
- package/dist/client/permissions/MenuPermissions.d.ts +0 -12
- package/dist/client/permissions/Permissions.d.ts +0 -12
- package/dist/client/permissions/PluginPermissions.d.ts +0 -12
- package/dist/client/permissions/RolesResourcesActions.d.ts +0 -11
- package/dist/client/permissions/ScopeSelect.d.ts +0 -11
- package/dist/client/permissions/StrategyActions.d.ts +0 -10
- package/dist/client/permissions/style.d.ts +0 -9
- package/dist/client/roles-manager.d.ts +0 -18
- package/dist/client/schemas/roles.d.ts +0 -63
- package/dist/client/schemas/scopes.d.ts +0 -75
- package/dist/externalVersion.js +0 -31
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -48
- package/dist/locale/en-US.json +0 -6
- package/dist/locale/ko_KR.json +0 -4
- package/dist/locale/zh-CN.json +0 -11
- package/dist/server/actions/available-actions.d.ts +0 -15
- package/dist/server/actions/available-actions.js +0 -51
- package/dist/server/actions/role-check.d.ts +0 -9
- package/dist/server/actions/role-check.js +0 -76
- package/dist/server/actions/role-collections.d.ts +0 -15
- package/dist/server/actions/role-collections.js +0 -84
- package/dist/server/actions/user-setDefaultRole.d.ts +0 -10
- package/dist/server/actions/user-setDefaultRole.js +0 -74
- package/dist/server/collections/roles-users.d.ts +0 -10
- package/dist/server/collections/roles-users.js +0 -39
- package/dist/server/collections/roles.d.ts +0 -10
- package/dist/server/collections/roles.js +0 -128
- package/dist/server/collections/rolesResources.d.ts +0 -10
- package/dist/server/collections/rolesResources.js +0 -64
- package/dist/server/collections/rolesResourcesActions.d.ts +0 -10
- package/dist/server/collections/rolesResourcesActions.js +0 -60
- package/dist/server/collections/rolesResourcesScopes.d.ts +0 -10
- package/dist/server/collections/rolesResourcesScopes.js +0 -54
- package/dist/server/collections/users.d.ts +0 -14
- package/dist/server/collections/users.js +0 -61
- package/dist/server/index.d.ts +0 -13
- package/dist/server/index.js +0 -56
- package/dist/server/middlewares/setCurrentRole.d.ts +0 -10
- package/dist/server/middlewares/setCurrentRole.js +0 -86
- package/dist/server/middlewares/with-acl-meta.d.ts +0 -10
- package/dist/server/middlewares/with-acl-meta.js +0 -255
- package/dist/server/migrations/20221214072638-set-role-snippets.d.ts +0 -14
- package/dist/server/migrations/20221214072638-set-role-snippets.js +0 -53
- package/dist/server/model/RoleModel.d.ts +0 -16
- package/dist/server/model/RoleModel.js +0 -55
- package/dist/server/model/RoleResourceActionModel.d.ts +0 -17
- package/dist/server/model/RoleResourceActionModel.js +0 -53
- package/dist/server/model/RoleResourceModel.d.ts +0 -20
- package/dist/server/model/RoleResourceModel.js +0 -72
- package/dist/server/server.d.ts +0 -24
- package/dist/server/server.js +0 -552
- package/dist/swagger/index.d.ts +0 -374
- package/dist/swagger/index.js +0 -404
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
declare const availableActionResource: {
|
|
10
|
-
name: string;
|
|
11
|
-
actions: {
|
|
12
|
-
list(ctx: any, next: any): Promise<void>;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export { availableActionResource };
|
|
@@ -1,51 +0,0 @@
|
|
|
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 available_actions_exports = {};
|
|
28
|
-
__export(available_actions_exports, {
|
|
29
|
-
availableActionResource: () => availableActionResource
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(available_actions_exports);
|
|
32
|
-
const availableActionResource = {
|
|
33
|
-
name: "availableActions",
|
|
34
|
-
actions: {
|
|
35
|
-
async list(ctx, next) {
|
|
36
|
-
const acl = ctx.app.acl;
|
|
37
|
-
const availableActions = acl.getAvailableActions();
|
|
38
|
-
ctx.body = Array.from(availableActions.entries()).map(([, { name, options }]) => {
|
|
39
|
-
return {
|
|
40
|
-
...options,
|
|
41
|
-
name
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
await next();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
availableActionResource
|
|
51
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
export declare function checkAction(ctx: any, next: any): Promise<void>;
|
|
@@ -1,76 +0,0 @@
|
|
|
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 role_check_exports = {};
|
|
28
|
-
__export(role_check_exports, {
|
|
29
|
-
checkAction: () => checkAction
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(role_check_exports);
|
|
32
|
-
const map2obj = (map) => {
|
|
33
|
-
const obj = {};
|
|
34
|
-
for (const [key, value] of map) {
|
|
35
|
-
obj[key] = value;
|
|
36
|
-
}
|
|
37
|
-
return obj;
|
|
38
|
-
};
|
|
39
|
-
async function checkAction(ctx, next) {
|
|
40
|
-
const currentRole = ctx.state.currentRole;
|
|
41
|
-
const roleInstance = await ctx.db.getRepository("roles").findOne({
|
|
42
|
-
filter: {
|
|
43
|
-
name: currentRole
|
|
44
|
-
},
|
|
45
|
-
appends: ["menuUiSchemas"]
|
|
46
|
-
});
|
|
47
|
-
if (!roleInstance) {
|
|
48
|
-
throw new Error(`Role ${currentRole} not exists`);
|
|
49
|
-
}
|
|
50
|
-
const anonymous = await ctx.db.getRepository("roles").findOne({
|
|
51
|
-
filter: {
|
|
52
|
-
name: "anonymous"
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
let role = ctx.app.acl.getRole(currentRole);
|
|
56
|
-
if (!role) {
|
|
57
|
-
await ctx.app.emitAsync("acl:writeRoleToACL", roleInstance);
|
|
58
|
-
role = ctx.app.acl.getRole(currentRole);
|
|
59
|
-
}
|
|
60
|
-
const availableActions = ctx.app.acl.getAvailableActions();
|
|
61
|
-
ctx.body = {
|
|
62
|
-
...role.toJSON(),
|
|
63
|
-
availableActions: [...availableActions.keys()],
|
|
64
|
-
resources: [...role.resources.keys()],
|
|
65
|
-
actionAlias: map2obj(ctx.app.acl.actionAlias),
|
|
66
|
-
allowAll: currentRole === "root",
|
|
67
|
-
allowConfigure: roleInstance.get("allowConfigure"),
|
|
68
|
-
allowMenuItemIds: roleInstance.get("menuUiSchemas").map((uiSchema) => uiSchema.get("x-uid")),
|
|
69
|
-
allowAnonymous: !!anonymous
|
|
70
|
-
};
|
|
71
|
-
await next();
|
|
72
|
-
}
|
|
73
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
-
0 && (module.exports = {
|
|
75
|
-
checkAction
|
|
76
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
declare const roleCollectionsResource: {
|
|
10
|
-
name: string;
|
|
11
|
-
actions: {
|
|
12
|
-
list(ctx: any, next: any): Promise<void>;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export { roleCollectionsResource };
|
|
@@ -1,84 +0,0 @@
|
|
|
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 role_collections_exports = {};
|
|
28
|
-
__export(role_collections_exports, {
|
|
29
|
-
roleCollectionsResource: () => roleCollectionsResource
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(role_collections_exports);
|
|
32
|
-
function totalPage(total, pageSize) {
|
|
33
|
-
return Math.ceil(total / pageSize);
|
|
34
|
-
}
|
|
35
|
-
const roleCollectionsResource = {
|
|
36
|
-
name: "roles.collections",
|
|
37
|
-
actions: {
|
|
38
|
-
async list(ctx, next) {
|
|
39
|
-
const role = ctx.action.params.associatedIndex;
|
|
40
|
-
const { page = 1, pageSize = 20 } = ctx.action.params;
|
|
41
|
-
const db = ctx.db;
|
|
42
|
-
const collectionRepository = db.getRepository("collections");
|
|
43
|
-
const fieldRepository = db.getRepository("fields");
|
|
44
|
-
const [collections, count] = await collectionRepository.findAndCount({
|
|
45
|
-
filter: ctx.action.params.filter,
|
|
46
|
-
sort: "sort"
|
|
47
|
-
});
|
|
48
|
-
const roleResources = await db.getRepository("rolesResources").find({
|
|
49
|
-
filter: {
|
|
50
|
-
roleName: role
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
const roleResourcesNames = roleResources.map((roleResource) => roleResource.get("name"));
|
|
54
|
-
const roleResourceActionResourceNames = roleResources.filter((roleResources2) => roleResources2.get("usingActionsConfig")).map((roleResources2) => roleResources2.get("name"));
|
|
55
|
-
const items = collections.map((collection, i) => {
|
|
56
|
-
const exists = roleResourcesNames.includes(collection.get("name"));
|
|
57
|
-
const usingConfig = roleResourceActionResourceNames.includes(collection.get("name")) ? "resourceAction" : "strategy";
|
|
58
|
-
const c = db.getCollection(collection.get("name"));
|
|
59
|
-
return {
|
|
60
|
-
type: "collection",
|
|
61
|
-
name: collection.get("name"),
|
|
62
|
-
collectionName: collection.get("name"),
|
|
63
|
-
title: collection.get("title"),
|
|
64
|
-
roleName: role,
|
|
65
|
-
usingConfig,
|
|
66
|
-
exists
|
|
67
|
-
// children: children.length > 0 ? children : null,
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
ctx.body = {
|
|
71
|
-
count,
|
|
72
|
-
rows: items,
|
|
73
|
-
page: Number(page),
|
|
74
|
-
pageSize: Number(pageSize),
|
|
75
|
-
totalPage: totalPage(count, pageSize)
|
|
76
|
-
};
|
|
77
|
-
await next();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
-
0 && (module.exports = {
|
|
83
|
-
roleCollectionsResource
|
|
84
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
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 { Context, Next } from '@nocobase/actions';
|
|
10
|
-
export declare function setDefaultRole(ctx: Context, next: Next): Promise<any>;
|
|
@@ -1,74 +0,0 @@
|
|
|
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 user_setDefaultRole_exports = {};
|
|
28
|
-
__export(user_setDefaultRole_exports, {
|
|
29
|
-
setDefaultRole: () => setDefaultRole
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(user_setDefaultRole_exports);
|
|
32
|
-
async function setDefaultRole(ctx, next) {
|
|
33
|
-
const {
|
|
34
|
-
values: { roleName }
|
|
35
|
-
} = ctx.action.params;
|
|
36
|
-
const {
|
|
37
|
-
db,
|
|
38
|
-
state: { currentUser },
|
|
39
|
-
action: {
|
|
40
|
-
params: { values }
|
|
41
|
-
}
|
|
42
|
-
} = ctx;
|
|
43
|
-
if (values.roleName == "anonymous") {
|
|
44
|
-
return next();
|
|
45
|
-
}
|
|
46
|
-
const repository = db.getRepository("rolesUsers");
|
|
47
|
-
await db.sequelize.transaction(async (transaction) => {
|
|
48
|
-
await repository.update({
|
|
49
|
-
filter: {
|
|
50
|
-
userId: currentUser.id
|
|
51
|
-
},
|
|
52
|
-
values: {
|
|
53
|
-
default: false
|
|
54
|
-
},
|
|
55
|
-
transaction
|
|
56
|
-
});
|
|
57
|
-
await repository.update({
|
|
58
|
-
filter: {
|
|
59
|
-
userId: currentUser.id,
|
|
60
|
-
roleName
|
|
61
|
-
},
|
|
62
|
-
values: {
|
|
63
|
-
default: true
|
|
64
|
-
},
|
|
65
|
-
transaction
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
ctx.body = "ok";
|
|
69
|
-
await next();
|
|
70
|
-
}
|
|
71
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
-
0 && (module.exports = {
|
|
73
|
-
setDefaultRole
|
|
74
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
-
export default _default;
|
|
@@ -1,39 +0,0 @@
|
|
|
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 roles_users_exports = {};
|
|
28
|
-
__export(roles_users_exports, {
|
|
29
|
-
default: () => roles_users_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(roles_users_exports);
|
|
32
|
-
var import_database = require("@nocobase/database");
|
|
33
|
-
var roles_users_default = (0, import_database.defineCollection)({
|
|
34
|
-
name: "rolesUsers",
|
|
35
|
-
dumpRules: {
|
|
36
|
-
group: "user"
|
|
37
|
-
},
|
|
38
|
-
fields: [{ type: "boolean", name: "default" }]
|
|
39
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
-
export default _default;
|
|
@@ -1,128 +0,0 @@
|
|
|
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 roles_exports = {};
|
|
28
|
-
__export(roles_exports, {
|
|
29
|
-
default: () => roles_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(roles_exports);
|
|
32
|
-
var import_database = require("@nocobase/database");
|
|
33
|
-
var roles_default = (0, import_database.defineCollection)({
|
|
34
|
-
origin: "@nocobase/plugin-acl",
|
|
35
|
-
dumpRules: "required",
|
|
36
|
-
name: "roles",
|
|
37
|
-
title: '{{t("Roles")}}',
|
|
38
|
-
autoGenId: false,
|
|
39
|
-
model: "RoleModel",
|
|
40
|
-
filterTargetKey: "name",
|
|
41
|
-
// targetKey: 'name',
|
|
42
|
-
sortable: true,
|
|
43
|
-
fields: [
|
|
44
|
-
{
|
|
45
|
-
type: "uid",
|
|
46
|
-
name: "name",
|
|
47
|
-
prefix: "r_",
|
|
48
|
-
primaryKey: true,
|
|
49
|
-
interface: "input",
|
|
50
|
-
uiSchema: {
|
|
51
|
-
type: "string",
|
|
52
|
-
title: '{{t("Role UID")}}',
|
|
53
|
-
"x-component": "Input"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: "string",
|
|
58
|
-
name: "title",
|
|
59
|
-
unique: true,
|
|
60
|
-
interface: "input",
|
|
61
|
-
uiSchema: {
|
|
62
|
-
type: "string",
|
|
63
|
-
title: '{{t("Role name")}}',
|
|
64
|
-
"x-component": "Input"
|
|
65
|
-
},
|
|
66
|
-
translation: true
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: "boolean",
|
|
70
|
-
name: "default"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: "string",
|
|
74
|
-
name: "description"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
type: "json",
|
|
78
|
-
name: "strategy"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
type: "boolean",
|
|
82
|
-
name: "default",
|
|
83
|
-
defaultValue: false
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: "boolean",
|
|
87
|
-
name: "hidden",
|
|
88
|
-
defaultValue: false
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
type: "boolean",
|
|
92
|
-
name: "allowConfigure"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
type: "boolean",
|
|
96
|
-
name: "allowNewMenu"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
type: "belongsToMany",
|
|
100
|
-
name: "menuUiSchemas",
|
|
101
|
-
target: "uiSchemas",
|
|
102
|
-
targetKey: "x-uid"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
type: "hasMany",
|
|
106
|
-
name: "resources",
|
|
107
|
-
target: "dataSourcesRolesResources",
|
|
108
|
-
sourceKey: "name",
|
|
109
|
-
foreignKey: "roleName"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
type: "set",
|
|
113
|
-
name: "snippets",
|
|
114
|
-
defaultValue: ["!ui.*", "!pm", "!pm.*"]
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
type: "belongsToMany",
|
|
118
|
-
name: "users",
|
|
119
|
-
target: "users",
|
|
120
|
-
foreignKey: "roleName",
|
|
121
|
-
otherKey: "userId",
|
|
122
|
-
onDelete: "CASCADE",
|
|
123
|
-
sourceKey: "name",
|
|
124
|
-
targetKey: "id",
|
|
125
|
-
through: "rolesUsers"
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
-
export default _default;
|
|
@@ -1,64 +0,0 @@
|
|
|
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 rolesResources_exports = {};
|
|
28
|
-
__export(rolesResources_exports, {
|
|
29
|
-
default: () => rolesResources_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(rolesResources_exports);
|
|
32
|
-
var import_database = require("@nocobase/database");
|
|
33
|
-
var rolesResources_default = (0, import_database.defineCollection)({
|
|
34
|
-
dumpRules: "required",
|
|
35
|
-
name: "rolesResources",
|
|
36
|
-
model: "RoleResourceModel",
|
|
37
|
-
indexes: [
|
|
38
|
-
{
|
|
39
|
-
unique: true,
|
|
40
|
-
fields: ["roleName", "name"]
|
|
41
|
-
}
|
|
42
|
-
],
|
|
43
|
-
fields: [
|
|
44
|
-
{
|
|
45
|
-
type: "belongsTo",
|
|
46
|
-
name: "role",
|
|
47
|
-
foreignKey: "roleName",
|
|
48
|
-
targetKey: "name"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: "string",
|
|
52
|
-
name: "name"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: "boolean",
|
|
56
|
-
name: "usingActionsConfig"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: "hasMany",
|
|
60
|
-
name: "actions",
|
|
61
|
-
target: "rolesResourcesActions"
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
-
export default _default;
|
|
@@ -1,60 +0,0 @@
|
|
|
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 rolesResourcesActions_exports = {};
|
|
28
|
-
__export(rolesResourcesActions_exports, {
|
|
29
|
-
default: () => rolesResourcesActions_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(rolesResourcesActions_exports);
|
|
32
|
-
var import_database = require("@nocobase/database");
|
|
33
|
-
var rolesResourcesActions_default = (0, import_database.defineCollection)({
|
|
34
|
-
dumpRules: "required",
|
|
35
|
-
name: "rolesResourcesActions",
|
|
36
|
-
model: "RoleResourceActionModel",
|
|
37
|
-
fields: [
|
|
38
|
-
{
|
|
39
|
-
type: "belongsTo",
|
|
40
|
-
name: "resource",
|
|
41
|
-
foreignKey: "rolesResourceId",
|
|
42
|
-
target: "rolesResources"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: "string",
|
|
46
|
-
name: "name"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: "array",
|
|
50
|
-
name: "fields",
|
|
51
|
-
defaultValue: []
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
type: "belongsTo",
|
|
55
|
-
name: "scope",
|
|
56
|
-
target: "rolesResourcesScopes",
|
|
57
|
-
onDelete: "RESTRICT"
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
});
|