new Permission(rbac, action, resource, add, cb)
Permission constructor
| Name | Type | Default | Description |
|---|---|---|---|
rbac |
RBAC | Instance of the RBAC | |
action |
String | Name of the action | |
resource |
String | Name of the resource | |
add |
Boolean | true | optional True if you need to save it to storage |
cb |
function | Callback function after add |
Extends
Members
-
actionString
-
Get action name of actual permission
-
nameString
-
Get name of actual instance
-
rbacRBAC null
-
Get instance of RBAC
-
resourceString
-
Get resource name of actual permission
Methods
-
staticPermission.createName(action, resource){String}
-
Compute name of permission from action and resource
Name Type Description actionString Name of permission resourceString Resource of permission Returns:
name of permission
-
staticPermission.isValidName(name){Boolean}
-
Correct name can contain only alphanumeric characters
Name Type Description nameString Name -
can(action, resource){Boolean}
-
Return true if has same action and resource
Name Type Description actionString Name of action resourceString Name of resource -
Remove this from RBAC (storage)
Name Type Description cbfunction Callback function