Role constructor
| Name | Type | Default | Description |
|---|---|---|---|
rbac |
RBAC | Instance of the RBAC | |
name |
String | Name of the role | |
add |
Boolean | true | optional True if you need to save it to storage |
cb |
function | Callback function after add |
Extends
Members
-
nameString
-
Get name of actual instance
-
rbacRBAC null
-
Get instance of RBAC
Methods
-
Return true if contains permission
Name Type Description actionString Name of action resourceString Name of resource cbfunction Callback function Returns:
current instance of role
-
Check if the model has all of the given permissions
Name Type Description permissionsArray List of permissions. Each has structure (String action, String resource) cbfunction Callback function Returns:
current instance of role
-
Check if the role has any of the given permissions
Name Type Description permissionsArray List of permissions. Each has structure (String action, String resource) cbfunction Callback function Returns:
current instance of role
-
Return array of permission assigned to actual role
Name Type Description cbfunction Callback function Returns:
current instance of role
-
Add role or permission to current role
Name Type Description itemRole | Permission Instance of role or permission cbfunction Callback function Returns:
current instance of role
-
Return true if the current role contains the specified role name
Name Type Description roleChildNameString Name of role cbfunction Callback function Returns:
current instance of role
-
Remove this from RBAC (storage)
Name Type Description cbfunction Callback function -
Remove role or permission from current role
Name Type Description itemRole | Permission Instance of role or permission cbfunction Callback function Returns:
current instance of role