@yongdall/organization-rbac 0.7.1 → 0.7.2
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.mjs +1 -1
- package/{organization-rbac-Bbuq32zd.mjs → organization-rbac-CnfkAqq-.mjs} +3 -5
- package/organization-rbac-CnfkAqq-.mjs.map +1 -0
- package/package.json +1 -1
- package/yongdall/migration.mjs +1 -1
- package/yongdall/model.mjs +1 -1
- package/yongdall/user.mjs +1 -1
- package/organization-rbac-Bbuq32zd.mjs.map +0 -1
package/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OrganizationUserRole, c as CompositeRole, i as getOrganizations, l as OrganizationUserCompositeRole, n as getOrganizationPermissions, o as OrganizationMember, r as getOrganizationRoleIds, s as OrganizationAppointment, t as getOrganizationAllPermissions, u as OrganizationCompositeRole } from "./organization-rbac-
|
|
1
|
+
import { a as OrganizationUserRole, c as CompositeRole, i as getOrganizations, l as OrganizationUserCompositeRole, n as getOrganizationPermissions, o as OrganizationMember, r as getOrganizationRoleIds, s as OrganizationAppointment, t as getOrganizationAllPermissions, u as OrganizationCompositeRole } from "./organization-rbac-CnfkAqq-.mjs";
|
|
2
2
|
export { CompositeRole, OrganizationAppointment, OrganizationCompositeRole, OrganizationMember, OrganizationUserCompositeRole, OrganizationUserRole, getOrganizationAllPermissions, getOrganizationPermissions, getOrganizationRoleIds, getOrganizations };
|
|
@@ -92,11 +92,9 @@ const OrganizationCompositeRole = createModel("organizationCompositeRole", {
|
|
|
92
92
|
if (!mainOrganizationId) return;
|
|
93
93
|
const organizationModel = await getModel("organization");
|
|
94
94
|
if (organizationModel) {
|
|
95
|
-
const [organization] = await useDatabase(organizationModel.databaseId).call(new Query(organizationModel).where({
|
|
96
|
-
id: record.organizationId,
|
|
97
|
-
mainId: mainOrganizationId
|
|
98
|
-
}).limit(1));
|
|
95
|
+
const [organization] = await useDatabase(organizationModel.databaseId).call(new Query(organizationModel).where({ id: record.organizationId }).limit(1));
|
|
99
96
|
if (!organization) throw new ServerError("请选择关联组织");
|
|
97
|
+
if (organization.mainId !== mainOrganizationId && organization.parentId !== mainOrganizationId) throw new ServerError("请选择关联组织");
|
|
100
98
|
}
|
|
101
99
|
const roleModel = await getModel("role");
|
|
102
100
|
if (roleModel?.fields.open) {
|
|
@@ -506,4 +504,4 @@ const getOrganizationAllPermissions = createKeyStore(async (userId) => {
|
|
|
506
504
|
//#endregion
|
|
507
505
|
export { OrganizationUserRole as a, CompositeRole as c, getOrganizations as i, OrganizationUserCompositeRole as l, getOrganizationPermissions as n, OrganizationMember as o, getOrganizationRoleIds as r, OrganizationAppointment as s, getOrganizationAllPermissions as t, OrganizationCompositeRole as u };
|
|
508
506
|
|
|
509
|
-
//# sourceMappingURL=organization-rbac-
|
|
507
|
+
//# sourceMappingURL=organization-rbac-CnfkAqq-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organization-rbac-CnfkAqq-.mjs","names":[],"sources":["../../plugins/organization-rbac/constants.mts","../../plugins/organization-rbac/models/OrganizationCompositeRole.mts","../../plugins/organization-rbac/models/OrganizationUserCompositeRole.mts","../../plugins/organization-rbac/models/CompositeRole.mts","../../plugins/organization-rbac/models/OrganizationAppointment.mts","../../plugins/organization-rbac/models/OrganizationMember.mts","../../plugins/organization-rbac/models/OrganizationUserRole.mts","../../plugins/organization-rbac/index.mts"],"sourcesContent":["import PluginMeta from '@yongdall/plugin-meta';\nexport const {\n\tid: pluginId,\n\tdatabase: database,\n} = PluginMeta();\n","import { createField, createModel, now, Query } from '@yongdall/model';\nimport { database } from '../constants.mts';\nimport { CompositeRole } from './CompositeRole.mts';\nimport { getModel, ServerError } from '@yongdall/core';\nimport { useDatabase } from '@yongdall/connection';\n\nexport const OrganizationCompositeRole = createModel('organizationCompositeRole', {\n\tcompositeRoleId: createField('uuid', { nullable: false, index: true, label: '复合角色', model: 'compositeRole', renderer: 'document', immutable: true, primary: 1, bind: {\n\t\tmainOrganizationId: { source: 'organizationId', clear: true },\n\t} }),\n\torganizationId: createField('uuid', { nullable: false, index: true, label: '组织', model: 'organization', renderer: 'document', immutable: true, primary: 2, source: {\n\t\tsearch: 'mainId=?mainOrganizationId'\n\t} }),\n\troleId: createField('uuid', { nullable: false, index: true, label: '角色', model: 'role', renderer: 'document', immutable: true, primary: 3 }),\n\tmainOrganizationId: createField('uuid', { nullable: false, index: true, label: '主体组织', model: 'organization', renderer: 'document', immutable: true, layout: {hidden: true} }),\n\n\tcreatedAt: createField('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n}, {\n\n\tpermissions: [\n\t\t{ permission: 'system:compositeRole', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'destroy'] },\n\t\t{ permission: 'system:compositeRole', organizationField: 'organizationId', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy'] },\n\t],\n\tdatabase,\n\tlabel: '组织复合角色配置',\n\thooks: {\n\t\tasync beforeCreate(conn, model, record) {\n\t\t\tif (!record.organizationId) { throw new ServerError('组织不存在') }\n\t\t\tif (!record.roleId) { throw new ServerError('角色不存在') }\n\t\t\tconst [compositeRole] = await conn.call(\n\t\t\t\tnew Query(CompositeRole).where({ id: record.compositeRoleId }).limit(1)\n\t\t\t)\n\t\t\tif (!compositeRole) {\n\t\t\t\tthrow new Error('复合角色不存在')\n\t\t\t}\n\t\t\tconst mainOrganizationId = compositeRole.organizationId || null;\n\t\t\tif (record.mainOrganizationId && record.mainOrganizationId !== mainOrganizationId) {\n\t\t\t\tthrow new ServerError('主体组织不匹配');\n\t\t\t}\n\t\t\tif (!mainOrganizationId) { return }\n\t\t\tconst organizationModel = await getModel('organization')\n\t\t\tif (organizationModel) {\n\t\t\t\tconst [organization] = await useDatabase(organizationModel.databaseId).call(\n\t\t\t\t\tnew Query(organizationModel).where({ id: record.organizationId }).limit(1)\n\t\t\t\t)\n\t\t\t\tif (!organization) {\n\t\t\t\t\tthrow new ServerError('请选择关联组织');\n\t\t\t\t}\n\t\t\t\tif (organization.mainId !== mainOrganizationId && organization.parentId !== mainOrganizationId) {\n\t\t\t\t\tthrow new ServerError('请选择关联组织');\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst roleModel = await getModel('role')\n\t\t\tif (roleModel?.fields.open) {\n\t\t\t\tconst [role] = await useDatabase(roleModel.databaseId).call(\n\t\t\t\t\tnew Query(roleModel).where({ id: record.organizationId, open: true }).limit(1)\n\t\t\t\t)\n\t\t\t\tif (!role) {\n\t\t\t\t\tthrow new ServerError('请选择有效角色');\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { ...record, mainOrganizationId };\n\t\t},\n\t}\n});\n","import { actions, createField, createModel, now, Query, uuid, Where} from '@yongdall/model';\nimport { database } from '../constants.mts';\nimport { CompositeRole } from './CompositeRole.mts';\nimport { ServerError } from '@yongdall/core';\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 OrganizationUserCompositeRole = createModel('organizationUserCompositeRole', {\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 }),\n\tcompositeRoleId: createField('uuid', { nullable: false, index: true, label: '角色', model: 'compositeRole', renderer: 'document', immutable: true, primary: 2 }),\n\n\tcreatedAt: createField('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n},{\n\tdatabase,\n\tlabel: '用户复合角色',\n\n\tpermissions: [\n\t\t{ permission: 'system:compositeRole', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'destroy'] },\n\t\t{ permission: 'system:compositeRole', organizationField: 'organizationId', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy'] },\n\t],\n\thooks: {\n\t\tasync afterCreate(conn, model, record) {\n\t\t\tconst [compositeRole] = await conn.call(\n\t\t\t\tnew Query(CompositeRole).where({ id: record.compositeRoleId }).limit(1)\n\t\t\t)\n\t\t\tif (!compositeRole) {\n\t\t\t\tthrow new ServerError('复合角色不存在')\n\t\t\t}\n\t\t\tif ((compositeRole.organizationId || null) === (record.organizationId || null)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow new ServerError('复合角色与组织不匹配');\n\t\t},\n\t}\n});\n","import { Action, actions, createField, createModel, now, Query, uuid, Where } from '@yongdall/model';\nimport { database } from '../constants.mts';\nimport { getModel, ServerError } from '@yongdall/core';\nimport { useDatabase } from '@yongdall/connection';\nimport { OrganizationCompositeRole } from './OrganizationCompositeRole.mts';\nimport { OrganizationUserCompositeRole } from './OrganizationUserCompositeRole.mts';\n\n\nexport const CompositeRole = createModel('compositeRole', {\n\tid: createField('uuid', { nullable: false, default: uuid, primary: 1, uncreatable: true, layout: { hidden: true } }),\n\tlabel: createField('string', { size: 255, nullable: false, default: '', label: '名称', layout: { colSpan: 6 } }),\n\torganizationId: createField('uuid', { nullable: true, index: true, label: '组织', model: 'organization', renderer: 'document', immutable: true, source: { search: 'internal=0' } }),\n\tdescription: createField('text', { nullable: true, label: '描述' }),\n\n\tcreatedAt: createField('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n}, {\n\tdatabase,\n\tlabelField: 'label',\n\tlabel: '复合角色',\n\n\tpermissions: [\n\t\t{ permission: 'system:compositeRole', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t\t{ permission: 'system:compositeRole', organizationField: 'organizationId', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t],\n\thooks: {\n\t\tasync afterCreate(conn, model, { organizationId }) {\n\t\t\tif (!organizationId) { return; }\n\t\t\tconst organizationModel = await getModel('organization')\n\t\t\tif (!organizationModel) { return; }\n\t\t\tconst [organization] = await useDatabase(organizationModel.databaseId).call(\n\t\t\t\tnew Query(organizationModel).where({ id: organizationId, internal: false }).limit(1)\n\t\t\t)\n\t\t\tif (organization) { return; }\n\t\t\tthrow new ServerError('请选择外部组织');\n\t\t},\n\t\tasync afterDelete(conn, model, record, update) {\n\t\t\tconst list = [\n\t\t\t\tconn.call(Action.delete(OrganizationUserCompositeRole, Where.and({ compositeRoleId: record.id })))\n\t\t\t]\n\n\t\t\tif (!update) {\n\t\t\t\tlist.push(\n\t\t\t\t\tconn.call(Action.delete(OrganizationCompositeRole, Where.and({ compositeRoleId: record.id })))\n\t\t\t\t)\n\t\t\t}\n\t\t\tawait Promise.all(list)\n\t\t},\n\t}\n});\n","import { createField, createModel, now, uuid } from '@yongdall/model';\nimport { database } from '../constants.mts';\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('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { 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\tdatabase,\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';\nimport { database } from '../constants.mts';\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('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n\n}, {\n\tdatabase,\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 { actions, createField, createModel, now, uuid, Where} from '@yongdall/model';\nimport { database } from '../constants.mts';\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\n\tcreatedAt: createField('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\n},{\n\tdatabase,\n\tpermissions: [\n\t\t{ permission: 'system:user', fields: '*', authorizations: ['query', 'read', 'create', 'destroy'] },\n\t],\n});\n","import { createKeyStore } from '@yongdall/context';\nimport { Query } from '@yongdall/model';\nimport { getUser } from '@yongdall/core';\nimport { useDatabase } from '@yongdall/connection';\nimport { findRolePermissions } from '@yongdall/role-permission';\nimport { OrganizationCompositeRole, OrganizationMember, OrganizationUserCompositeRole, OrganizationUserRole } from './models/index.mts';\n\nexport * from './models/index.mts';\n\n\n/** 所在组织 */\nexport const getOrganizations = createKeyStore(async (userId: string | null) => {\n\tif (!userId) { return new Set(); }\n\tconst relations: { organizationId: string }[] = await useDatabase(OrganizationMember.databaseId).call(\n\t\tnew Query(OrganizationMember).select(['organizationId']).where('userId', userId)\n\t);\n\treturn new Set(relations.map(v => v.organizationId));\n}, user => user || '');\n\n\n/** 角色 */\nexport const getOrganizationRoleIds = createKeyStore(async (userId: string | null) => {\n\tconst compositeRoleIds = new Query(OrganizationUserCompositeRole).select('compositeRoleId').where('userId', '=', userId)\n\tconst list: { organizationId: number; roleId: string; }[][] = await Promise.all([\n\t\tuseDatabase(OrganizationUserRole.databaseId).call(\n\t\t\tnew Query(OrganizationUserRole).select(['organizationId', 'roleId'])\n\t\t\t\t.where('userId', userId)\n\t\t),\n\t\tuseDatabase(OrganizationCompositeRole.databaseId).call(\n\t\t\tnew Query(OrganizationCompositeRole).select(['organizationId', 'roleId'])\n\t\t\t\t.where('compositeRoleId', 'in', compositeRoleIds)\n\t\t)\n\t]);\n\n\treturn Object.fromEntries((Object.entries(Object.groupBy(list.flat(), v => v.organizationId))\n\t\t.map(([organizationId, list]) => [organizationId, new Set(list?.map(v => v.roleId))])))\n}, user => user || '');\n\n\nexport const getOrganizationPermissions = createKeyStore(async (userId: string | null) => {\n\tconst roleIds = await getOrganizationRoleIds(userId)\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}, user => user || '');\n\n\n\nexport const getOrganizationAllPermissions = createKeyStore(async (userId: string | null) => {\n\tconst v = await getOrganizationPermissions(userId)\n\treturn new Set(Object.values(v).flatMap(v => [...v]));\n}, user => user || '');\n"],"mappings":";;;;;;;AACA,MAAa,EACZ,IAAI,UACM,aACP,WAAW;;;ACEf,MAAa,4BAA4B,YAAY,6BAA6B;CACjF,iBAAiB,YAAY,QAAQ;EAAE,UAAU;EAAO,OAAO;EAAM,OAAO;EAAQ,OAAO;EAAiB,UAAU;EAAY,WAAW;EAAM,SAAS;EAAG,MAAM,EACpK,oBAAoB;GAAE,QAAQ;GAAkB,OAAO;EAAK,EAC7D;CAAE,CAAC;CACH,gBAAgB,YAAY,QAAQ;EAAE,UAAU;EAAO,OAAO;EAAM,OAAO;EAAM,OAAO;EAA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AAG,SAAQ,QAAQ,EAAE;AAGrB,MAAa,6BAA6B,eAAe,OAAO,WAA0B;CACzF,MAAM,UAAU,MAAM,uBAAuB,MAAM;CACnD,MAAM,aAAa,CAAC,GAAG,IAAI,IAAI,OAAO,OAAO,OAAO,CAAC,CAAC,SAAQ,MAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC3E,MAAM,cAA2C,OAAO,OAAO,IAAI;CACnE,IAAI,CAAC,WAAW,QAAU,OAAO;CACjC,MAAM,SAAS,MAAM,oBAAoB,UAAU;CACnD,MAAM,OAAO,OAAO,YAAY,OAAO,QAAQ,OAAO,QAAQ,SAAQ,MAAK,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,GAAG,KAAI,MAAK,EAAE,UAAU,CAAC,CAAC,CAAC;CACrI,KAAK,MAAM,CAAC,cAAc,YAAY,OAAO,QAAQ,OAAO,GAAG;EAC9D,MAAM,IAAI,IAAI,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,SAAQ,MAAK,KAAK,MAAM,CAAC,CAAC,CAAC;EAC1D,IAAI,CAAC,EAAE,MAAQ;EACf,YAAY,gBAAgB;CAC7B;CACA,OAAO;AACR,IAAG,SAAQ,QAAQ,EAAE;AAIrB,MAAa,gCAAgC,eAAe,OAAO,WAA0B;CAC5F,MAAM,IAAI,MAAM,2BAA2B,MAAM;CACjD,OAAO,IAAI,IAAI,OAAO,OAAO,CAAC,CAAC,CAAC,SAAQ,MAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,IAAG,SAAQ,QAAQ,EAAE"}
|
package/package.json
CHANGED
package/yongdall/migration.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OrganizationUserRole, c as CompositeRole, l as OrganizationUserCompositeRole, o as OrganizationMember, s as OrganizationAppointment, u as OrganizationCompositeRole } from "../organization-rbac-
|
|
1
|
+
import { a as OrganizationUserRole, c as CompositeRole, l as OrganizationUserCompositeRole, o as OrganizationMember, s as OrganizationAppointment, u as OrganizationCompositeRole } from "../organization-rbac-CnfkAqq-.mjs";
|
|
2
2
|
//#region plugins/organization-rbac/yongdall/migration.mts
|
|
3
3
|
const models = [
|
|
4
4
|
OrganizationAppointment,
|
package/yongdall/model.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OrganizationUserRole, c as CompositeRole, l as OrganizationUserCompositeRole, o as OrganizationMember, s as OrganizationAppointment, u as OrganizationCompositeRole } from "../organization-rbac-
|
|
1
|
+
import { a as OrganizationUserRole, c as CompositeRole, l as OrganizationUserCompositeRole, o as OrganizationMember, s as OrganizationAppointment, u as OrganizationCompositeRole } from "../organization-rbac-CnfkAqq-.mjs";
|
|
2
2
|
//#region plugins/organization-rbac/yongdall/model.mts
|
|
3
3
|
const models = {
|
|
4
4
|
organizationAppointment: OrganizationAppointment,
|
package/yongdall/user.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getOrganizationPermissions, t as getOrganizationAllPermissions } from "../organization-rbac-
|
|
1
|
+
import { n as getOrganizationPermissions, t as getOrganizationAllPermissions } from "../organization-rbac-CnfkAqq-.mjs";
|
|
2
2
|
export { getOrganizationAllPermissions, getOrganizationPermissions };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"organization-rbac-Bbuq32zd.mjs","names":[],"sources":["../../plugins/organization-rbac/constants.mts","../../plugins/organization-rbac/models/OrganizationCompositeRole.mts","../../plugins/organization-rbac/models/OrganizationUserCompositeRole.mts","../../plugins/organization-rbac/models/CompositeRole.mts","../../plugins/organization-rbac/models/OrganizationAppointment.mts","../../plugins/organization-rbac/models/OrganizationMember.mts","../../plugins/organization-rbac/models/OrganizationUserRole.mts","../../plugins/organization-rbac/index.mts"],"sourcesContent":["import PluginMeta from '@yongdall/plugin-meta';\nexport const {\n\tid: pluginId,\n\tdatabase: database,\n} = PluginMeta();\n","import { createField, createModel, now, Query } from '@yongdall/model';\nimport { database } from '../constants.mts';\nimport { CompositeRole } from './CompositeRole.mts';\nimport { getModel, ServerError } from '@yongdall/core';\nimport { useDatabase } from '@yongdall/connection';\n\nexport const OrganizationCompositeRole = createModel('organizationCompositeRole', {\n\tcompositeRoleId: createField('uuid', { nullable: false, index: true, label: '复合角色', model: 'compositeRole', renderer: 'document', immutable: true, primary: 1, bind: {\n\t\tmainOrganizationId: { source: 'organizationId', clear: true },\n\t} }),\n\torganizationId: createField('uuid', { nullable: false, index: true, label: '组织', model: 'organization', renderer: 'document', immutable: true, primary: 2, source: {\n\t\tsearch: 'mainId=?mainOrganizationId'\n\t} }),\n\troleId: createField('uuid', { nullable: false, index: true, label: '角色', model: 'role', renderer: 'document', immutable: true, primary: 3 }),\n\tmainOrganizationId: createField('uuid', { nullable: false, index: true, label: '主体组织', model: 'organization', renderer: 'document', immutable: true, layout: {hidden: true} }),\n\n\tcreatedAt: createField('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n}, {\n\n\tpermissions: [\n\t\t{ permission: 'system:compositeRole', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'destroy'] },\n\t\t{ permission: 'system:compositeRole', organizationField: 'organizationId', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy'] },\n\t],\n\tdatabase,\n\tlabel: '组织复合角色配置',\n\thooks: {\n\t\tasync beforeCreate(conn, model, record) {\n\t\t\tif (!record.organizationId) { throw new ServerError('组织不存在') }\n\t\t\tif (!record.roleId) { throw new ServerError('角色不存在') }\n\t\t\tconst [compositeRole] = await conn.call(\n\t\t\t\tnew Query(CompositeRole).where({ id: record.compositeRoleId }).limit(1)\n\t\t\t)\n\t\t\tif (!compositeRole) {\n\t\t\t\tthrow new Error('复合角色不存在')\n\t\t\t}\n\t\t\tconst mainOrganizationId = compositeRole.organizationId || null;\n\t\t\tif (record.mainOrganizationId && record.mainOrganizationId !== mainOrganizationId) {\n\t\t\t\tthrow new ServerError('主体组织不匹配');\n\t\t\t}\n\t\t\tif (!mainOrganizationId) { return }\n\t\t\tconst organizationModel = await getModel('organization')\n\t\t\tif (organizationModel) {\n\t\t\t\tconst [organization] = await useDatabase(organizationModel.databaseId).call(\n\t\t\t\t\tnew Query(organizationModel).where({ id: record.organizationId, mainId: mainOrganizationId }).limit(1)\n\t\t\t\t)\n\t\t\t\tif (!organization) {\n\t\t\t\t\tthrow new ServerError('请选择关联组织');\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tconst roleModel = await getModel('role')\n\t\t\tif (roleModel?.fields.open) {\n\t\t\t\tconst [role] = await useDatabase(roleModel.databaseId).call(\n\t\t\t\t\tnew Query(roleModel).where({ id: record.organizationId, open: true }).limit(1)\n\t\t\t\t)\n\t\t\t\tif (!role) {\n\t\t\t\t\tthrow new ServerError('请选择有效角色');\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {...record, mainOrganizationId};\n\t\t},\n\t}\n});\n","import { actions, createField, createModel, now, Query, uuid, Where} from '@yongdall/model';\nimport { database } from '../constants.mts';\nimport { CompositeRole } from './CompositeRole.mts';\nimport { ServerError } from '@yongdall/core';\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 OrganizationUserCompositeRole = createModel('organizationUserCompositeRole', {\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 }),\n\tcompositeRoleId: createField('uuid', { nullable: false, index: true, label: '角色', model: 'compositeRole', renderer: 'document', immutable: true, primary: 2 }),\n\n\tcreatedAt: createField('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n},{\n\tdatabase,\n\tlabel: '用户复合角色',\n\n\tpermissions: [\n\t\t{ permission: 'system:compositeRole', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'destroy'] },\n\t\t{ permission: 'system:compositeRole', organizationField: 'organizationId', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy'] },\n\t],\n\thooks: {\n\t\tasync afterCreate(conn, model, record) {\n\t\t\tconst [compositeRole] = await conn.call(\n\t\t\t\tnew Query(CompositeRole).where({ id: record.compositeRoleId }).limit(1)\n\t\t\t)\n\t\t\tif (!compositeRole) {\n\t\t\t\tthrow new ServerError('复合角色不存在')\n\t\t\t}\n\t\t\tif ((compositeRole.organizationId || null) === (record.organizationId || null)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthrow new ServerError('复合角色与组织不匹配');\n\t\t},\n\t}\n});\n","import { Action, actions, createField, createModel, now, Query, uuid, Where } from '@yongdall/model';\nimport { database } from '../constants.mts';\nimport { getModel, ServerError } from '@yongdall/core';\nimport { useDatabase } from '@yongdall/connection';\nimport { OrganizationCompositeRole } from './OrganizationCompositeRole.mts';\nimport { OrganizationUserCompositeRole } from './OrganizationUserCompositeRole.mts';\n\n\nexport const CompositeRole = createModel('compositeRole', {\n\tid: createField('uuid', { nullable: false, default: uuid, primary: 1, uncreatable: true, layout: { hidden: true } }),\n\tlabel: createField('string', { size: 255, nullable: false, default: '', label: '名称', layout: { colSpan: 6 } }),\n\torganizationId: createField('uuid', { nullable: true, index: true, label: '组织', model: 'organization', renderer: 'document', immutable: true, source: { search: 'internal=0' } }),\n\tdescription: createField('text', { nullable: true, label: '描述' }),\n\n\tcreatedAt: createField('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n}, {\n\tdatabase,\n\tlabelField: 'label',\n\tlabel: '复合角色',\n\n\tpermissions: [\n\t\t{ permission: 'system:compositeRole', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t\t{ permission: 'system:compositeRole', organizationField: 'organizationId', fields: ['*'], authorizations: ['options', 'query', 'read', 'create', 'update', 'destroy', 'add', 'remove'] },\n\t],\n\thooks: {\n\t\tasync afterCreate(conn, model, { organizationId }) {\n\t\t\tif (!organizationId) { return; }\n\t\t\tconst organizationModel = await getModel('organization')\n\t\t\tif (!organizationModel) { return; }\n\t\t\tconst [organization] = await useDatabase(organizationModel.databaseId).call(\n\t\t\t\tnew Query(organizationModel).where({ id: organizationId, internal: false }).limit(1)\n\t\t\t)\n\t\t\tif (organization) { return; }\n\t\t\tthrow new ServerError('请选择外部组织');\n\t\t},\n\t\tasync afterDelete(conn, model, record, update) {\n\t\t\tconst list = [\n\t\t\t\tconn.call(Action.delete(OrganizationUserCompositeRole, Where.and({ compositeRoleId: record.id })))\n\t\t\t]\n\n\t\t\tif (!update) {\n\t\t\t\tlist.push(\n\t\t\t\t\tconn.call(Action.delete(OrganizationCompositeRole, Where.and({ compositeRoleId: record.id })))\n\t\t\t\t)\n\t\t\t}\n\t\t\tawait Promise.all(list)\n\t\t},\n\t}\n});\n","import { createField, createModel, now, uuid } from '@yongdall/model';\nimport { database } from '../constants.mts';\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('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { 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\tdatabase,\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';\nimport { database } from '../constants.mts';\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('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\tupdatedAt: createField('timestamp', { nullable: false, default: now, updating: now, label: '最后更新日期' }),\n\n}, {\n\tdatabase,\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 { actions, createField, createModel, now, uuid, Where} from '@yongdall/model';\nimport { database } from '../constants.mts';\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\n\tcreatedAt: createField('timestamp', { nullable: false, default: now, creating: now, label: '创建日期' }),\n\n},{\n\tdatabase,\n\tpermissions: [\n\t\t{ permission: 'system:user', fields: '*', authorizations: ['query', 'read', 'create', 'destroy'] },\n\t],\n});\n","import { createKeyStore } from '@yongdall/context';\nimport { Query } from '@yongdall/model';\nimport { getUser } from '@yongdall/core';\nimport { useDatabase } from '@yongdall/connection';\nimport { findRolePermissions } from '@yongdall/role-permission';\nimport { OrganizationCompositeRole, OrganizationMember, OrganizationUserCompositeRole, OrganizationUserRole } from './models/index.mts';\n\nexport * from './models/index.mts';\n\n\n/** 所在组织 */\nexport const getOrganizations = createKeyStore(async (userId: string | null) => {\n\tif (!userId) { return new Set(); }\n\tconst relations: { organizationId: string }[] = await useDatabase(OrganizationMember.databaseId).call(\n\t\tnew Query(OrganizationMember).select(['organizationId']).where('userId', userId)\n\t);\n\treturn new Set(relations.map(v => v.organizationId));\n}, user => user || '');\n\n\n/** 角色 */\nexport const getOrganizationRoleIds = createKeyStore(async (userId: string | null) => {\n\tconst compositeRoleIds = new Query(OrganizationUserCompositeRole).select('compositeRoleId').where('userId', '=', userId)\n\tconst list: { organizationId: number; roleId: string; }[][] = await Promise.all([\n\t\tuseDatabase(OrganizationUserRole.databaseId).call(\n\t\t\tnew Query(OrganizationUserRole).select(['organizationId', 'roleId'])\n\t\t\t\t.where('userId', userId)\n\t\t),\n\t\tuseDatabase(OrganizationCompositeRole.databaseId).call(\n\t\t\tnew Query(OrganizationCompositeRole).select(['organizationId', 'roleId'])\n\t\t\t\t.where('compositeRoleId', 'in', compositeRoleIds)\n\t\t)\n\t]);\n\n\treturn Object.fromEntries((Object.entries(Object.groupBy(list.flat(), v => v.organizationId))\n\t\t.map(([organizationId, list]) => [organizationId, new Set(list?.map(v => v.roleId))])))\n}, user => user || '');\n\n\nexport const getOrganizationPermissions = createKeyStore(async (userId: string | null) => {\n\tconst roleIds = await getOrganizationRoleIds(userId)\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}, user => user || '');\n\n\n\nexport const getOrganizationAllPermissions = createKeyStore(async (userId: string | null) => {\n\tconst v = await getOrganizationPermissions(userId)\n\treturn new Set(Object.values(v).flatMap(v => [...v]));\n}, user => user || '');\n"],"mappings":";;;;;;;AACA,MAAa,EACZ,IAAI,UACM,aACP,WAAW;;;ACEf,MAAa,4BAA4B,YAAY,6BAA6B;CACjF,iBAAiB,YAAY,QAAQ;EAAE,UAAU;EAAO,OAAO;EAAM,OAAO;EAAQ,OAAO;EAAiB,UAAU;EAAY,WAAW;EAAM,SAAS;EAAG,MAAM,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