* fix: postgres sort with appends issue * fix: role menus api error * feat: add exists params in roles.collections api * refactor: remove uid field on uiSchemas table * test: toggle role menus * fix: plugin-acl test * feat: sync data to acl before app start * fix: mysql ui-schema sql compatibility * feat: writeRolesToACL in plugin-acl
22 lines
509 B
TypeScript
22 lines
509 B
TypeScript
import { Model } from '@nocobase/database';
|
|
import { ACL } from '@nocobase/acl';
|
|
|
|
export class RoleModel extends Model {
|
|
writeToAcl(options: { acl: ACL }) {
|
|
const { acl } = options;
|
|
const roleName = this.get('name') as string;
|
|
let role = acl.getRole(roleName);
|
|
|
|
if (!role) {
|
|
role = acl.define({
|
|
role: roleName,
|
|
});
|
|
}
|
|
|
|
role.setStrategy({
|
|
...((this.get('strategy') as object) || {}),
|
|
allowConfigure: this.get('allowConfigure') as boolean,
|
|
});
|
|
}
|
|
}
|