1.4 KiB
1.4 KiB
ACLResource
ACLResource is the resource class in ACL system. In ACL systems, the corresponding resource is created automatically when granting permission to user.
Class Methods
constructor()
Constructor.
Signature
constructor(options: AclResourceOptions)
Type
type ResourceActions = { [key: string]: RoleActionParams };
interface AclResourceOptions {
name: string; // Name of the resource
role: ACLRole; // Role to which the resource belongs
actions?: ResourceActions;
}
Detailed Information
Refer to aclRole.grantAction
for details about RoleActionParams
.
getActions()
Get all actions of the resource, the return is ResourceActions
object.
getAction()
Get the parameter configuration of the action by name, the return is RoleActionParams
object.
Detailed Information
Refer to aclRole.grantAction
for
RoleActionParams
.
setAction()
Set the parameter configuration of an action inside the resource, the return is RoleActionParams
object.
Signature
setAction(name: string, params: RoleActionParams)
Detailed Information
- name - Name of the action to set
- Refer to
aclRole.grantAction
for details aboutRoleActionParams
.
setActions()
Signature
setActions(actions: ResourceActions)
A shortcut for calling setAction
in batches.