fix(acl): availableActions
This commit is contained in:
parent
ad38b001c5
commit
407f9d2d85
@ -6,5 +6,5 @@ export interface AvailableActionOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class AclAvailableAction {
|
export class AclAvailableAction {
|
||||||
constructor(private name: string, private options: AvailableActionOptions) {}
|
constructor(public name: string, public options: AvailableActionOptions) {}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
|
|
||||||
const availableActionResource = {
|
const availableActionResource = {
|
||||||
name: 'availableActions',
|
name: 'availableActions',
|
||||||
actions: {
|
actions: {
|
||||||
async list(ctx, next) {
|
async list(ctx, next) {
|
||||||
const acl = ctx.app.acl;
|
const acl = ctx.app.acl;
|
||||||
const availableActions = acl.getAvailableActions();
|
const availableActions = acl.getAvailableActions();
|
||||||
ctx.body = Array.from(availableActions.entries()).map((item) => item[1]);
|
ctx.body = Array.from(availableActions.entries()).map(([, { name, options }]) => {
|
||||||
|
return {
|
||||||
|
...options,
|
||||||
|
name,
|
||||||
|
};
|
||||||
|
});
|
||||||
await next();
|
await next();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -4,28 +4,28 @@ const availableActions: {
|
|||||||
[key: string]: AvailableActionOptions;
|
[key: string]: AvailableActionOptions;
|
||||||
} = {
|
} = {
|
||||||
create: {
|
create: {
|
||||||
displayName: 't("Create")',
|
displayName: '{{ t("Create") }}',
|
||||||
type: 'new-data',
|
type: 'new-data',
|
||||||
},
|
},
|
||||||
import: {
|
import: {
|
||||||
displayName: 't("Import")',
|
displayName: '{{ t("Import") }}',
|
||||||
type: 'new-data',
|
type: 'new-data',
|
||||||
},
|
},
|
||||||
export: {
|
export: {
|
||||||
displayName: 't("Import")',
|
displayName: '{{ t("Export") }}',
|
||||||
type: 'new-data',
|
type: 'new-data',
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
displayName: 't("View")',
|
displayName: '{{ t("View") }}',
|
||||||
type: 'old-data',
|
type: 'old-data',
|
||||||
aliases: ['get', 'list'],
|
aliases: ['get', 'list'],
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
displayName: 't("Edit")',
|
displayName: '{{ t("Edit") }}',
|
||||||
type: 'old-data',
|
type: 'old-data',
|
||||||
},
|
},
|
||||||
destroy: {
|
destroy: {
|
||||||
displayName: 't("Delete")',
|
displayName: '{{ t("Delete") }}',
|
||||||
type: 'old-data',
|
type: 'old-data',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user