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 action
String Name of action resource
String Name of resource cb
function Callback function Returns:
current instance of role
-
Check if the model has all of the given permissions
Name Type Description permissions
Array List of permissions. Each has structure (String action, String resource) cb
function Callback function Returns:
current instance of role
-
Check if the role has any of the given permissions
Name Type Description permissions
Array List of permissions. Each has structure (String action, String resource) cb
function Callback function Returns:
current instance of role
-
Return array of permission assigned to actual role
Name Type Description cb
function Callback function Returns:
current instance of role
-
Add role or permission to current role
Name Type Description item
Role | Permission Instance of role or permission cb
function Callback function Returns:
current instance of role
-
Return true if the current role contains the specified role name
Name Type Description roleChildName
String Name of role cb
function Callback function Returns:
current instance of role
-
Remove this from RBAC (storage)
Name Type Description cb
function Callback function -
Remove role or permission from current role
Name Type Description item
Role | Permission Instance of role or permission cb
function Callback function Returns:
current instance of role