mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: test
This commit is contained in:
parent
65eb91bef3
commit
b80b6702ab
@ -170,7 +170,7 @@ export class ACL extends EventEmitter {
|
||||
}
|
||||
|
||||
getRoles(names: string[]): ACLRole[] {
|
||||
return names.map((name) => this.getRole(name));
|
||||
return names.map((name) => this.getRole(name)).filter((x) => Boolean(x));
|
||||
}
|
||||
|
||||
removeRole(name: string) {
|
||||
|
@ -39,7 +39,7 @@ export async function checkAction(ctx, next) {
|
||||
|
||||
let roles = ctx.app.acl.getRoles(currentRoles);
|
||||
if (!roles.length) {
|
||||
await ctx.app.emitAsync('acl:writeRoleToACL', roleInstances);
|
||||
await Promise.all(roleInstances.map((x) => ctx.app.emitAsync('acl:writeRoleToACL', x)));
|
||||
roles = ctx.app.acl.getRoles(currentRoles);
|
||||
}
|
||||
const availableActions = ctx.app.acl.getAvailableActions();
|
||||
|
@ -12,9 +12,7 @@ import _ from 'lodash';
|
||||
export function mergeRole(roles) {
|
||||
const result: Record<string, any> = {
|
||||
roles: [],
|
||||
strategy: {
|
||||
actions: [],
|
||||
},
|
||||
strategy: {},
|
||||
actions: null,
|
||||
snippets: [],
|
||||
resources: null,
|
||||
@ -35,6 +33,9 @@ function mergeRoleNames(sourceRoleNames, newRoleName) {
|
||||
}
|
||||
|
||||
function mergeRoleStrategy(sourceStrategy, newStrategy) {
|
||||
if (!newStrategy) {
|
||||
return sourceStrategy;
|
||||
}
|
||||
const actions = sourceStrategy.actions.concat(newStrategy.actions);
|
||||
return {
|
||||
...sourceStrategy,
|
||||
|
Loading…
x
Reference in New Issue
Block a user