@yongdall/organization-rbac 0.6.1 → 0.6.4

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/index.d.mts CHANGED
@@ -63,25 +63,13 @@ declare const OrganizationMember: _yongdall_model2.ModelTable<{
63
63
  }, string>;
64
64
  //#endregion
65
65
  //#region plugins/organization-rbac/index.d.mts
66
- /**
67
- * 所在组织
68
- * @returns
69
- */
66
+ /** 所在组织 */
70
67
  declare const useOrganizations: () => Promise<Set<string>>;
71
- /**
72
- * 角色
73
- * @returns {Promise<Record<string, Set<string>>>}
74
- */
68
+ /** 角色 */
75
69
  declare const useOrganizationRoleIds: () => Promise<{
76
70
  [k: string]: Set<string>;
77
71
  }>;
78
- /**
79
- * @returns {Promise<Record<string, Set<string>>>}
80
- */
81
- declare const useOrganizationPermissions: () => Promise<any>;
82
- /**
83
- * @returns {Promise<Set<string>>}
84
- */
85
- declare const useOrganizationAllPermissions: () => Promise<Set<any>>;
72
+ declare const useOrganizationPermissions: () => Promise<Record<string, Set<string>>>;
73
+ declare const useOrganizationAllPermissions: () => Promise<Set<string>>;
86
74
  //#endregion
87
75
  export { OrganizationAppointment, OrganizationMember, OrganizationUserRole, useOrganizationAllPermissions, useOrganizationPermissions, useOrganizationRoleIds, useOrganizations };
package/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as OrganizationMember, i as useOrganizations, n as useOrganizationPermissions, o as OrganizationUserRole, r as useOrganizationRoleIds, s as OrganizationAppointment, t as useOrganizationAllPermissions } from "./organization-rbac-aswOB2pV.mjs";
1
+ import { a as OrganizationMember, i as useOrganizations, n as useOrganizationPermissions, o as OrganizationUserRole, r as useOrganizationRoleIds, s as OrganizationAppointment, t as useOrganizationAllPermissions } from "./organization-rbac-BF8uzSCr.mjs";
2
2
 
3
3
  export { OrganizationAppointment, OrganizationMember, OrganizationUserRole, useOrganizationAllPermissions, useOrganizationPermissions, useOrganizationRoleIds, useOrganizations };
@@ -1,8 +1,8 @@
1
- import { RolePermission } from "@yongdall/role";
2
1
  import { createComputed } from "@yongdall/context";
3
2
  import { Query, Where, actions, createField, createModel, now, uuid } from "@yongdall/model";
4
3
  import { getUser } from "@yongdall/core";
5
4
  import { useDatabase } from "@yongdall/connection";
5
+ import { findRolePermissions } from "@yongdall/role-permission";
6
6
 
7
7
  //#region plugins/organization-rbac/models/OrganizationAppointment.mjs
8
8
  const OrganizationAppointment = createModel("organizationAppointment", {
@@ -191,41 +191,28 @@ const OrganizationMember = createModel("organizationMember", {
191
191
  });
192
192
 
193
193
  //#endregion
194
- //#region plugins/organization-rbac/index.mjs
195
- /**
196
- * 所在组织
197
- * @returns
198
- */
194
+ //#region plugins/organization-rbac/index.mts
195
+ /** 所在组织 */
199
196
  const useOrganizations = createComputed(async () => {
200
197
  const id = await getUser();
201
- /** @type {{organizationId: string}[]} */
202
198
  const relations = await useDatabase().call(actions.select(new Query(OrganizationMember).select(["organizationId"]).where("userId", id)));
203
199
  return new Set(relations.map((v) => v.organizationId));
204
200
  });
205
- /**
206
- * 角色
207
- * @returns {Promise<Record<string, Set<string>>>}
208
- */
201
+ /** 角色 */
209
202
  const useOrganizationRoleIds = createComputed(async () => {
210
203
  const organizations = await useOrganizations();
211
204
  if (!organizations.size) return {};
212
205
  const id = await getUser();
213
- /** @type {{organizationId: number; roleId: string;}[]} */
214
206
  const list = await useDatabase().call(actions.select(new Query(OrganizationUserRole).select(["organizationId", "roleId"]).where("organizationId", "in", [...organizations]).where("userId", id)));
215
207
  return Object.fromEntries(Object.entries(Object.groupBy(list, (v) => v.organizationId)).map(([organizationId, list]) => [organizationId, new Set(list?.map((v) => v.roleId))]));
216
208
  });
217
- /**
218
- * @returns {Promise<Record<string, Set<string>>>}
219
- */
220
209
  const useOrganizationPermissions = createComputed(async () => {
221
210
  const roleIds = await useOrganizationRoleIds();
222
211
  const allRoleIds = [...new Set(Object.values(roleIds).flatMap((v) => [...v]))];
223
- if (!allRoleIds.length) return Object.create(null);
224
- /** @type {{permission: string; roleId: string}[]} */
225
- const values = await useDatabase().call(actions.select(new Query(RolePermission).select(["permission", "roleId"]).where("roleId", "in", allRoleIds)));
226
- const list = Object.fromEntries(Object.entries(Object.groupBy(values, (l) => l.roleId)).map(([k, v]) => [k, v?.map((v) => v.permission)]));
227
- /** @type {Record<string, Set<string>>} */
228
212
  const permissions = Object.create(null);
213
+ if (!allRoleIds.length) return permissions;
214
+ const values = await findRolePermissions(allRoleIds);
215
+ const list = Object.fromEntries(Object.entries(Object.groupBy(values, (l) => l.roleId)).map(([k, v]) => [k, v?.map((v) => v.permission)]));
229
216
  for (const [organization, roleSet] of Object.entries(roleIds)) {
230
217
  const s = new Set([...roleSet].flatMap((v) => list[v] || []));
231
218
  if (!s.size) continue;
@@ -233,9 +220,6 @@ const useOrganizationPermissions = createComputed(async () => {
233
220
  }
234
221
  return permissions;
235
222
  });
236
- /**
237
- * @returns {Promise<Set<string>>}
238
- */
239
223
  const useOrganizationAllPermissions = createComputed(async () => {
240
224
  const v = await useOrganizationPermissions();
241
225
  return new Set(Object.values(v).flatMap((v) => [...v]));
@@ -243,4 +227,4 @@ const useOrganizationAllPermissions = createComputed(async () => {
243
227
 
244
228
  //#endregion
245
229
  export { OrganizationMember as a, useOrganizations as i, useOrganizationPermissions as n, OrganizationUserRole as o, useOrganizationRoleIds as r, OrganizationAppointment as s, useOrganizationAllPermissions as t };
246
- //# sourceMappingURL=organization-rbac-aswOB2pV.mjs.map
230
+ //# sourceMappingURL=organization-rbac-BF8uzSCr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization-rbac-BF8uzSCr.mjs","names":[],"sources":["../../plugins/organization-rbac/models/OrganizationAppointment.mjs","../../plugins/organization-rbac/models/OrganizationMember.mjs","../../plugins/organization-rbac/index.mts"],"sourcesContent":["import { createField, createModel, now, uuid } from '@yongdall/model';\n\n\n\n// export const OrganizationAppointmentRole = createModel('organizationAppointmentRole', {\n// \tappointmentId: createField('uuid', { nullable: false, index: true, label: '职务', model: 'appointment', renderer: 'document', immutable: true, primary: 1 }),\n// \troleId: createField('uuid', { nullable: false, index: true, label: '角色', model: 'role', renderer: 'document', immutable: true, primary: 2 }),\n// \tno: createField('i32', { nullable: false, default: 0 }),\n// });\n\nexport const OrganizationAppointment = createModel('organizationAppointment', {\n\tid: createField('uuid', { nullable: false, primary: 1, default: uuid, uncreatable: true, immutable: true }),\n\n\tlabel: createField('string', { nullable: false, label: '职务名称' }),\n\tdescription: createField('string', { nullable: true, label: '描述' }),\n\n\tcreatedAt: createField('date', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('date', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n\n\t// roles: createField(OrganizationAppointmentRole, { \n\t// \tarray: true, \n\t// \tconstraints: { appointmentId: { field: 'id' }, no: { noField: true } }, \n\t// \tlabel: '角色列表' \n\t// }),\n}, {\n\n\tpermissions: [\n\t\t{ permission: 'system:organization', fields: '*', authorizations: ['query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t],\n});\n","import { actions, createField, createModel, now, uuid, Where} from '@yongdall/model';\n\n/**\n * 组织用户角色模型\n * @typedef {Object} OrganizationUserRole\n * @property {string} userId - 用户ID,主键第一部分\n * @property {string} organizationId - 组织ID,主键第二部分\n * @property {string} roleId - 角色ID,主键第三部分\n * @property {number} no - 编号\n */\nexport const OrganizationUserRole = createModel('organizationUserRole', {\n\tuserId: createField('uuid', { nullable: false, index: true, label: '用户', model: 'user', renderer: 'document', immutable: true, primary: 1 }),\n\torganizationId: createField('uuid', { nullable: false, index: true, label: '组织', model: 'organization', renderer: 'document', immutable: true, primary: 2 }),\n\troleId: createField('uuid', { nullable: false, index: true, label: '角色', model: 'role', renderer: 'document', immutable: true, primary: 3 }),\n\n\tno: createField('i32', { nullable: false, default: 0 }),\n});\n\n\nexport const OrganizationMember = createModel('organizationMember', {\n\tid: createField('uuid', { nullable: false, index: true, primary: 1, default: uuid, uncreatable: true, immutable: true }),\n\n\tuserId: createField('uuid', { nullable: false, index: true, label: '用户', model: 'user', renderer: 'document', immutable: true, layout: { rowSpan: 6 } }),\n\torganizationId: createField('uuid', { nullable: false, index: true, label: '组织', model: 'organization', renderer: 'document', immutable: true, layout: { rowSpan: 6 } }),\n\tappointmentId: createField('uuid', { nullable: true, index: true, label: '职务', model: 'appointment', renderer: 'document', layout: { rowSpan: 6 } }),\n\n\tdefault: createField('bool', { nullable: false, default: false, label: '默认职务' }),\n\n\tcreatedAt: createField('date', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('date', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n\n\troles: createField(OrganizationUserRole, {\n\t\tarray: true,\n\t\tconstraints: {\n\t\t\torganizationId: { field: 'organizationId' },\n\t\t\tuserId: { field: 'userId' },\n\t\t\tno: { noField: true }\n\t\t},\n\t\tlabel: '角色列表',\n\t\tlayout: {\n\t\t\tcolumns: [{ actions: ['add', 'remove'] }, { field: 'roleId', placeholder: 1 }],\n\t\t},\n\t}),\n}, {\n\tindexes: [\n\t\t{ fields: ['userId', 'organizationId', 'appointmentId'], unique: true }\n\t],\n\tpermissions: [\n\t\t{ permission: 'system:user', fields: '*', authorizations: ['query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t],\n\thooks: {\n\t\tasync afterCreate(conn, Model, record) {\n\t\t\tif (!record.default) { return }\n\t\t\tawait conn.call(actions.update(\n\t\t\t\tModel,\n\t\t\t\t{ default: false },\n\t\t\t\tWhere.and('organizationId', '=', record.organizationId, true)\n\t\t\t\t\t.and('userId', record.userId),\n\t\t\t));\n\t\t},\n\n\t\tasync afterUpdate(conn, Model, record, oldRecord) {\n\t\t\tif (!record.default) { return }\n\t\t\tif (oldRecord.default) { return }\n\t\t\tawait conn.call(actions.update(\n\t\t\t\tModel,\n\t\t\t\t{ default: false },\n\t\t\t\tWhere.and('organizationId', '=', record.organizationId, true)\n\t\t\t\t\t.and('userId', record.userId),\n\t\t\t));\n\t\t},\n\t}\n});\n","import { createComputed } from '@yongdall/context';\nimport { actions, Query } from '@yongdall/model';\nimport { getUser } from '@yongdall/core';\nimport { useDatabase } from '@yongdall/connection';\nimport { findRolePermissions } from '@yongdall/role-permission';\nimport { OrganizationMember, OrganizationUserRole } from './models/index.mjs';\n\nexport * from './models/index.mjs';\n\n\n/** 所在组织 */\nexport const useOrganizations = createComputed(async () => {\n\tconst id = await getUser();\n\tconst relations: {organizationId: string}[] = await useDatabase().call(actions.select(\n\t\tnew Query(OrganizationMember).select(['organizationId']).where('userId', id)\n\t));\n\treturn new Set(relations.map(v => v.organizationId));\n});\n\n\n/** 角色 */\nexport const useOrganizationRoleIds = createComputed(async () => {\n\tconst organizations = await useOrganizations()\n\tif (!organizations.size) { return {}; }\n\tconst id = await getUser();\n\tconst list: {organizationId: number; roleId: string;}[] = await useDatabase().call(actions.select(\n\t\tnew Query(OrganizationUserRole).select(['organizationId', 'roleId'])\n\t\t\t.where('organizationId', 'in', [...organizations])\n\t\t\t.where('userId', id)\n\t));\n\treturn Object.fromEntries((Object.entries(Object.groupBy(list, v => v.organizationId))\n\t\t.map(([organizationId, list]) => [organizationId, new Set(list?.map(v => v.roleId))])))\n});\n\n\nexport const useOrganizationPermissions = createComputed(async () => {\n\tconst roleIds = await useOrganizationRoleIds()\n\tconst allRoleIds = [...new Set(Object.values(roleIds).flatMap(v =>[...v]))];\n\tconst permissions: Record<string, Set<string>> = Object.create(null);\n\tif (!allRoleIds.length) { return permissions; }\n\tconst values = await findRolePermissions(allRoleIds);\n\tconst list = Object.fromEntries(Object.entries(Object.groupBy(values, l => l.roleId)).map(([k,v]) => [k, v?.map(v => v.permission)]));\n\tfor (const [organization, roleSet] of Object.entries(roleIds)) {\n\t\tconst s = new Set([...roleSet].flatMap(v => list[v] || []));\n\t\tif (!s.size) { continue; }\n\t\tpermissions[organization] = s;\n\t}\n\treturn permissions;\n});\n\n\n\nexport const useOrganizationAllPermissions = createComputed(async () => {\n\tconst v = await useOrganizationPerm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UAAU,CAAC,gBAAgB,IAAI,IAAI,MAAM,KAAI,MAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAE;EACvF;AAGF,MAAa,6BAA6B,eAAe,YAAY;CACpE,MAAM,UAAU,MAAM,wBAAwB;CAC9C,MAAM,aAAa,CAAC,GAAG,IAAI,IAAI,OAAO,OAAO,QAAQ,CAAC,SAAQ,MAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;CAC3E,MAAM,cAA2C,OAAO,OAAO,KAAK;AACpE,KAAI,CAAC,WAAW,OAAU,QAAO;CACjC,MAAM,SAAS,MAAM,oBAAoB,WAAW;CACpD,MAAM,OAAO,OAAO,YAAY,OAAO,QAAQ,OAAO,QAAQ,SAAQ,MAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,GAAE,OAAO,CAAC,GAAG,GAAG,KAAI,MAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AACrI,MAAK,MAAM,CAAC,cAAc,YAAY,OAAO,QAAQ,QAAQ,EAAE;EAC9D,MAAM,IAAI,IAAI,IAAI,CAAC,GAAG,QAAQ,CAAC,SAAQ,MAAK,KAAK,MAAM,EAAE,CAAC,CAAC;AAC3D,MAAI,CAAC,EAAE,KAAQ;AACf,cAAY,gBAAgB;;AAE7B,QAAO;EACN;AAIF,MAAa,gCAAgC,eAAe,YAAY;CACvE,MAAM,IAAI,MAAM,4BAA4B;AAC5C,QAAO,IAAI,IAAI,OAAO,OAAO,EAAE,CAAC,SAAQ,MAAK,CAAC,GAAG,EAAE,CAAC,CAAC;EACpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yongdall/organization-rbac",
3
- "version": "0.6.1",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "main": "./index.mjs",
6
6
  "exports": {
@@ -11,14 +11,14 @@
11
11
  "author": "",
12
12
  "license": "ISC",
13
13
  "dependencies": {
14
- "@yongdall/connection": "^0.6.1",
15
- "@yongdall/context": "^0.6.1",
16
- "@yongdall/core": "^0.6.1",
17
- "@yongdall/model": "^0.6.1",
18
- "@yongdall/role": "^0.6.1"
14
+ "@yongdall/connection": "^0.6.4",
15
+ "@yongdall/context": "^0.6.4",
16
+ "@yongdall/core": "^0.6.4",
17
+ "@yongdall/model": "^0.6.4",
18
+ "@yongdall/role-permission": "^0.6.4"
19
19
  },
20
20
  "devDependencies": {
21
- "@yongdall/migrate": "^0.6.1",
22
- "@yongdall/types": "^0.6.1"
21
+ "@yongdall/migrate": "^0.6.4",
22
+ "@yongdall/types": "^0.6.4"
23
23
  }
24
24
  }
@@ -1,14 +1,9 @@
1
- import { a as OrganizationMember, s as OrganizationAppointment } from "../organization-rbac-aswOB2pV.mjs";
2
- import { Role } from "@yongdall/role";
1
+ import { a as OrganizationMember, s as OrganizationAppointment } from "../organization-rbac-BF8uzSCr.mjs";
3
2
 
4
3
  //#region plugins/organization-rbac/yongdall/migration.mjs
5
4
  /** @import { Profile } from '@yongdall/migrate' */
6
5
  /** @type {Profile['models']} */
7
- const models = [
8
- OrganizationAppointment,
9
- OrganizationMember,
10
- Role
11
- ];
6
+ const models = [OrganizationAppointment, OrganizationMember];
12
7
 
13
8
  //#endregion
14
9
  export { models };
@@ -1 +1 @@
1
- {"version":3,"file":"migration.mjs","names":[],"sources":["../../../plugins/organization-rbac/yongdall/migration.mjs"],"sourcesContent":["/** @import { Profile } from '@yongdall/migrate' */\nimport { Role } from '@yongdall/role';\nimport { OrganizationAppointment, OrganizationMember } from '../index.mjs';\n\n\n/** @type {Profile['models']} */\nexport const models = [\n\tOrganizationAppointment,\n\tOrganizationMember,\n\tRole,\n];\n"],"mappings":";;;;;;AAMA,MAAa,SAAS;CACrB;CACA;CACA;CACA"}
1
+ {"version":3,"file":"migration.mjs","names":[],"sources":["../../../plugins/organization-rbac/yongdall/migration.mjs"],"sourcesContent":["/** @import { Profile } from '@yongdall/migrate' */\nimport { OrganizationAppointment, OrganizationMember } from '../index.mts';\n\n\n/** @type {Profile['models']} */\nexport const models = [\n\tOrganizationAppointment,\n\tOrganizationMember,\n];\n"],"mappings":";;;;;AAKA,MAAa,SAAS,CACrB,yBACA,mBACA"}
@@ -1,13 +1,11 @@
1
- import { a as OrganizationMember, s as OrganizationAppointment } from "../organization-rbac-aswOB2pV.mjs";
2
- import { Role } from "@yongdall/role";
1
+ import { a as OrganizationMember, s as OrganizationAppointment } from "../organization-rbac-BF8uzSCr.mjs";
3
2
 
4
3
  //#region plugins/organization-rbac/yongdall/model.mjs
5
4
  /** @import { ModelProfile } from '@yongdall/core' */
6
5
  /** @type {ModelProfile['models']} */
7
6
  const models = {
8
7
  organizationAppointment: OrganizationAppointment,
9
- organizationMember: OrganizationMember,
10
- role: Role
8
+ organizationMember: OrganizationMember
11
9
  };
12
10
 
13
11
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"model.mjs","names":[],"sources":["../../../plugins/organization-rbac/yongdall/model.mjs"],"sourcesContent":["/** @import { ModelProfile } from '@yongdall/core' */\nimport { Role } from '@yongdall/role';\nimport { OrganizationAppointment, OrganizationMember } from '../index.mjs';\n\n/** @type {ModelProfile['models']} */\nexport const models = {\n\torganizationAppointment: OrganizationAppointment,\n\torganizationMember: OrganizationMember,\n\trole: Role,\n};\n"],"mappings":";;;;;;AAKA,MAAa,SAAS;CACrB,yBAAyB;CACzB,oBAAoB;CACpB,MAAM;CACN"}
1
+ {"version":3,"file":"model.mjs","names":[],"sources":["../../../plugins/organization-rbac/yongdall/model.mjs"],"sourcesContent":["/** @import { ModelProfile } from '@yongdall/core' */\nimport { OrganizationAppointment, OrganizationMember } from '../index.mts';\n\n/** @type {ModelProfile['models']} */\nexport const models = {\n\torganizationAppointment: OrganizationAppointment,\n\torganizationMember: OrganizationMember,\n};\n"],"mappings":";;;;;AAIA,MAAa,SAAS;CACrB,yBAAyB;CACzB,oBAAoB;CACpB"}
package/yongdall/user.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as useOrganizationPermissions, t as useOrganizationAllPermissions } from "../organization-rbac-aswOB2pV.mjs";
1
+ import { n as useOrganizationPermissions, t as useOrganizationAllPermissions } from "../organization-rbac-BF8uzSCr.mjs";
2
2
 
3
3
  //#region plugins/organization-rbac/yongdall/user.mjs
4
4
  /** @import { UserManager } from '@yongdall/core' */
@@ -6,7 +6,7 @@ import { n as useOrganizationPermissions, t as useOrganizationAllPermissions } f
6
6
  const getOrganizationAllPermissions = () => {
7
7
  return useOrganizationAllPermissions();
8
8
  };
9
- /** @type {UserManager['getOrganizationAllPermissions']} */
9
+ /** @type {UserManager['getOrganizationPermissions']} */
10
10
  const getOrganizationPermissions = () => {
11
11
  return useOrganizationPermissions();
12
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"user.mjs","names":[],"sources":["../../../plugins/organization-rbac/yongdall/user.mjs"],"sourcesContent":["/** @import { UserManager } from '@yongdall/core' */\nimport { useOrganizationAllPermissions, useOrganizationPermissions } from '../index.mjs';\n\n\n/** @type {UserManager['getOrganizationAllPermissions']} */\nexport const getOrganizationAllPermissions = () => {\n\treturn useOrganizationAllPermissions();\n};\n/** @type {UserManager['getOrganizationAllPermissions']} */\nexport const getOrganizationPermissions = () => {\n\treturn useOrganizationPermissions();\n};\n"],"mappings":";;;;;AAKA,MAAa,sCAAsC;AAClD,QAAO,+BAA+B;;;AAGvC,MAAa,mCAAmC;AAC/C,QAAO,4BAA4B"}
1
+ {"version":3,"file":"user.mjs","names":[],"sources":["../../../plugins/organization-rbac/yongdall/user.mjs"],"sourcesContent":["/** @import { UserManager } from '@yongdall/core' */\nimport { useOrganizationAllPermissions, useOrganizationPermissions } from '../index.mts';\n\n\n/** @type {UserManager['getOrganizationAllPermissions']} */\nexport const getOrganizationAllPermissions = () => {\n\treturn useOrganizationAllPermissions();\n};\n/** @type {UserManager['getOrganizationPermissions']} */\nexport const getOrganizationPermissions = () => {\n\treturn useOrganizationPermissions();\n};\n"],"mappings":";;;;;AAKA,MAAa,sCAAsC;AAClD,QAAO,+BAA+B;;;AAGvC,MAAa,mCAAmC;AAC/C,QAAO,4BAA4B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"organization-rbac-aswOB2pV.mjs","names":[],"sources":["../../plugins/organization-rbac/models/OrganizationAppointment.mjs","../../plugins/organization-rbac/models/OrganizationMember.mjs","../../plugins/organization-rbac/index.mjs"],"sourcesContent":["import { createField, createModel, now, uuid } from '@yongdall/model';\n\n\n\n// export const OrganizationAppointmentRole = createModel('organizationAppointmentRole', {\n// \tappointmentId: createField('uuid', { nullable: false, index: true, label: '职务', model: 'appointment', renderer: 'document', immutable: true, primary: 1 }),\n// \troleId: createField('uuid', { nullable: false, index: true, label: '角色', model: 'role', renderer: 'document', immutable: true, primary: 2 }),\n// \tno: createField('i32', { nullable: false, default: 0 }),\n// });\n\nexport const OrganizationAppointment = createModel('organizationAppointment', {\n\tid: createField('uuid', { nullable: false, primary: 1, default: uuid, uncreatable: true, immutable: true }),\n\n\tlabel: createField('string', { nullable: false, label: '职务名称' }),\n\tdescription: createField('string', { nullable: true, label: '描述' }),\n\n\tcreatedAt: createField('date', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('date', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n\n\t// roles: createField(OrganizationAppointmentRole, { \n\t// \tarray: true, \n\t// \tconstraints: { appointmentId: { field: 'id' }, no: { noField: true } }, \n\t// \tlabel: '角色列表' \n\t// }),\n}, {\n\n\tpermissions: [\n\t\t{ permission: 'system:organization', fields: '*', authorizations: ['query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t],\n});\n","import { actions, createField, createModel, now, uuid, Where} from '@yongdall/model';\n\n/**\n * 组织用户角色模型\n * @typedef {Object} OrganizationUserRole\n * @property {string} userId - 用户ID,主键第一部分\n * @property {string} organizationId - 组织ID,主键第二部分\n * @property {string} roleId - 角色ID,主键第三部分\n * @property {number} no - 编号\n */\nexport const OrganizationUserRole = createModel('organizationUserRole', {\n\tuserId: createField('uuid', { nullable: false, index: true, label: '用户', model: 'user', renderer: 'document', immutable: true, primary: 1 }),\n\torganizationId: createField('uuid', { nullable: false, index: true, label: '组织', model: 'organization', renderer: 'document', immutable: true, primary: 2 }),\n\troleId: createField('uuid', { nullable: false, index: true, label: '角色', model: 'role', renderer: 'document', immutable: true, primary: 3 }),\n\n\tno: createField('i32', { nullable: false, default: 0 }),\n});\n\n\nexport const OrganizationMember = createModel('organizationMember', {\n\tid: createField('uuid', { nullable: false, index: true, primary: 1, default: uuid, uncreatable: true, immutable: true }),\n\n\tuserId: createField('uuid', { nullable: false, index: true, label: '用户', model: 'user', renderer: 'document', immutable: true, layout: { rowSpan: 6 } }),\n\torganizationId: createField('uuid', { nullable: false, index: true, label: '组织', model: 'organization', renderer: 'document', immutable: true, layout: { rowSpan: 6 } }),\n\tappointmentId: createField('uuid', { nullable: true, index: true, label: '职务', model: 'appointment', renderer: 'document', layout: { rowSpan: 6 } }),\n\n\tdefault: createField('bool', { nullable: false, default: false, label: '默认职务' }),\n\n\tcreatedAt: createField('date', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('date', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n\n\troles: createField(OrganizationUserRole, {\n\t\tarray: true,\n\t\tconstraints: {\n\t\t\torganizationId: { field: 'organizationId' },\n\t\t\tuserId: { field: 'userId' },\n\t\t\tno: { noField: true }\n\t\t},\n\t\tlabel: '角色列表',\n\t\tlayout: {\n\t\t\tcolumns: [{ actions: ['add', 'remove'] }, { field: 'roleId', placeholder: 1 }],\n\t\t},\n\t}),\n}, {\n\tindexes: [\n\t\t{ fields: ['userId', 'organizationId', 'appointmentId'], unique: true }\n\t],\n\tpermissions: [\n\t\t{ permission: 'system:user', fields: '*', authorizations: ['query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t],\n\thooks: {\n\t\tasync afterCreate(conn, Model, record) {\n\t\t\tif (!record.default) { return }\n\t\t\tawait conn.call(actions.update(\n\t\t\t\tModel,\n\t\t\t\t{ default: false },\n\t\t\t\tWhere.and('organizationId', '=', record.organizationId, true)\n\t\t\t\t\t.and('userId', record.userId),\n\t\t\t));\n\t\t},\n\n\t\tasync afterUpdate(conn, Model, record, oldRecord) {\n\t\t\tif (!record.default) { return }\n\t\t\tif (oldRecord.default) { return }\n\t\t\tawait conn.call(actions.update(\n\t\t\t\tModel,\n\t\t\t\t{ default: false },\n\t\t\t\tWhere.and('organizationId', '=', record.organizationId, true)\n\t\t\t\t\t.and('userId', record.userId),\n\t\t\t));\n\t\t},\n\t}\n});\n","import { createComputed } from '@yongdall/context';\nimport { actions, Query } from '@yongdall/model';\nimport { getUser } from '@yongdall/core';\nimport { useDatabase } from '@yongdall/connection';\nimport { RolePermission } from '@yongdall/role';\nimport { OrganizationMember, OrganizationUserRole } from './models/index.mjs';\n\nexport * from './models/index.mjs';\n\n\n/**\n * 所在组织\n * @returns \n */\nexport const useOrganizations = createComputed(async () => {\n\tconst id = await getUser();\n\t/** @type {{organizationId: string}[]} */\n\tconst relations = await useDatabase().call(actions.select(\n\t\tnew Query(OrganizationMember).select(['organizationId']).where('userId', id)\n\t));\n\treturn new Set(relations.map(v => v.organizationId));\n});\n\n\n/**\n * 角色\n * @returns {Promise<Record<string, Set<string>>>}\n */\nexport const useOrganizationRoleIds = createComputed(async () => {\n\tconst organizations = await useOrganizations()\n\tif (!organizations.size) { return {}; }\n\tconst id = await getUser();\n\t/** @type {{organizationId: number; roleId: string;}[]} */\n\tconst list = await useDatabase().call(actions.select(\n\t\tnew Query(OrganizationUserRole).select(['organizationId', 'roleId'])\n\t\t\t.where('organizationId', 'in', [...organizations])\n\t\t\t.where('userId', id)\n\t));\n\treturn Object.fromEntries((Object.entries(Object.groupBy(list, v => v.organizationId))\n\t\t.map(([organizationId, list]) => [organizationId, new Set(list?.map(v => v.roleId))])))\n});\n\n\n/**\n * @returns {Promise<Record<string, Set<string>>>}\n */\nexport const useOrganizationPermissions = createComputed(async () => {\n\tconst roleIds = await useOrganizationRoleIds()\n\tconst allRoleIds = [...new Set(Object.values(roleIds).flatMap(v =>[...v]))];\n\tif (!allRoleIds.length) { return Object.create(null); }\n\t/** @type {{permission: string; roleId: string}[]} */\n\tconst values = await useDatabase().call(actions.select(\n\t\tnew Query(RolePermission).select(['permission', 'roleId'])\n\t\t\t.where('roleId', 'in', allRoleIds)\n\t));\n\tconst list = Object.fromEntries(Object.entries(Object.groupBy(values, l => l.roleId)).map(([k,v]) => [k, v?.map(v => v.permission)]));\n\t/** @type {Record<string, Set<string>>} */\n\tconst permissions = Object.create(null);\n\tfor (const [organization, roleSet] of Object.entries(roleIds)) {\n\t\tconst s = new Set([...roleSet].flatMap(v => list[v] || []));\n\t\tif (!s.size) { continue; }\n\t\tpermissions[organization] = s;\n\t}\n\treturn permissions;\n});\n\n\n\n/**\n * @returns {Promise<Set<string>>}\n */\nexport const useOrganizationAllPermissions = createComputed(async () => {\n\tconst v = await useOrganizationPermissions()\n\treturn new Set(Object.values(v).flatMap(v => [...v]));\n});\n"],"mappings":";;;;;;;AAUA,MAAa,0BAA0B,YAAY,2BAA2B;CAC7E,IAAI,YAAY,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAG,SAAS;EAAM,aAAa;EAAM,WAAW;EAAM,CAAC;CAE3G,OAAO,YAAY,UAAU;EAAE,UAAU;EAAO,OAAO;EAAQ,CAAC;CAChE,aAAa,YAAY,UAAU;EAAE,UAAU;EAAM,OAAO;EAAM,CAAC;CAEnE,WAAW,YAAY,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAK,UAAU;EAAK,OAAO;EAAQ,CAAC;CAC/F,WAAW,YAAY,QAAQ;EAAE,UAAU;EAAO,SAAS;EAAK,UAAU;EAAK,OAAO;EAAU,CAAC;CAOjG,EAAE,EAEF,aAAa,CACZ;CAAE,YAAY;CAAuB,QAAQ;CAAK,gBAAgB;EAAC;EAAS;EAAQ;EAAU;EAAU;EAAW;EAAO;EAAS;CAAE,CACrI,EACD,CAAC;;;;;;;;;;;;ACnBF,MAAa,uBAAu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