ISetup
Defined in: src/types/ISetup.ts:22
Vocabulary declaration for AccessControl#setup.
setup() declares the vocabulary (which roles/groups, resources/categories
and actions exist); grant() declares permissions. For roles and
resources pass either a plain array (when you don’t need groups /
categories — all members are ungrouped) or a map keyed by group / category
name, with the reserved _ key listing the ungrouped / uncategorized members.
Examples
Section titled “Examples”// flat — no groups/categories neededac.setup({ roles: ['user', 'admin'], resources: ['profile', 'post'] });// groupedac.setup({ roles: { admins: ['admin', 'moderator'], _: ['user', 'viewer'] }, resources: { media: ['photo', 'video'], _: ['profile'] }, actions: ['publish', 'approve'],});Properties
Section titled “Properties”roles?
Section titled “roles?”
optionalroles?:string[] |Record<string,string[]>
Defined in: src/types/ISetup.ts:27
Either a flat array of (ungrouped) roles, or a group → member roles map.
In the map form the reserved _ key lists ungrouped roles.
resources?
Section titled “resources?”
optionalresources?:string[] |Record<string,string[]>
Defined in: src/types/ISetup.ts:32
Either a flat array of (uncategorized) resources, or a category → member resources map. In the map form the reserved _ key lists uncategorized ones.
actions?
Section titled “actions?”
optionalactions?:string[]
Defined in: src/types/ISetup.ts:34
Declared custom actions (feeds strict.actions).