-
staticRBAC.getPermissionNames(permissions){Array}
-
Convert Array of permissions to permission name
Name |
Type |
Description |
permissions |
Array
|
List of array items of permission names. It contan action and resource |
Returns:
of permission names
-
-
Register role or permission to actual RBAC instance
Name |
Type |
Description |
item |
Role
|
Permission
|
Instance of Base |
cb |
function
|
Callback function |
Returns:
actual instance
-
can(roleName, action, resource, cb){RBAC}
-
Return true if role has allowed permission
Name |
Type |
Description |
roleName |
String
|
Name of role |
action |
String
|
Name of action |
resource |
String
|
Name of resource |
cb |
function
|
Callback function |
Returns:
instance
-
canAll(roleName, permissions, cb){RBAC}
-
Check if the model has all of the given permissions.
Name |
Type |
Description |
roleName |
String
|
Name of role |
permissions |
Array
|
Array (String action, String resource) |
cb |
function
|
Callback function |
Returns:
instance
-
canAny(roleName, permissions, cb){RBAC}
-
Check if the role has any of the given permissions.
Name |
Type |
Description |
roleName |
String
|
Name of role |
permissions |
Array
|
Array (String action, String resource) |
cb |
function
|
Callback function |
Returns:
instance
-
create(roleNames, permissionNames, grants, cb){RBAC}
-
Create multiple permissions and roles in one step
Name |
Type |
Description |
roleNames |
Array
|
List of role names |
permissionNames |
Object
|
List of permission names |
grants |
Object
|
optional
List of grants |
cb |
Array
|
Callback function |
Returns:
of actual RBAC
-
createPermission(action, resource, add, cb){Permission}
-
Create a new permission assigned to actual instance of RBAC
Name |
Type |
Default |
Description |
action |
String
|
|
Name of action |
resource |
String
|
|
Name of resource |
add |
Boolean
|
true
|
optional
True if you need to add it to the storage |
cb |
function
|
|
Callback function |
Returns:
of the Permission
-
createPermissions(permissions, add, cb){RBAC}
-
Create multiple permissions in one step
Name |
Type |
Default |
Description |
permissions |
Object
|
|
Object of permissions |
add |
Boolean
|
true
|
optional
True if you need to add it to the storage |
cb |
function
|
|
Callbck function |
Returns:
of actual RBAC
-
createRole(roleName, add){Role}
-
Create a new role assigned to actual instance of RBAC
Name |
Type |
Default |
Description |
roleName |
String
|
|
Name of new Role |
add |
Boolean
|
true
|
optional
True if you need to add it to the storage |
Returns:
of the Role
-
createRoles(roleNames, add, cb){RBAC}
-
Create multiple roles in one step assigned to actual instance of RBAC
Name |
Type |
Default |
Description |
roleNames |
Array
|
|
Array of role names |
add |
Boolean
|
true
|
optional
True if you need to add it to the storage |
cb |
function
|
|
Callback function |
Returns:
instance
-
-
Callback returns true if role or permission exists
Name |
Type |
Description |
name |
String
|
Name of item |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
existsPermission(action, resource, cb){RBAC}
-
Callback returns true if permission exists
Name |
Type |
Description |
action |
String
|
Name of action |
resource |
String
|
Name of resource |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
existsRole(name, cb){RBAC}
-
Callback returns true if role exists
Name |
Type |
Description |
name |
String
|
Name of item |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
-
Get instance of Role or Permission by his name
Name |
Type |
Description |
name |
String
|
Name of item |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
getPermission(name, cb){RBAC}
-
Return instance of Permission by his name
Name |
Type |
Description |
name |
String
|
Name of permission |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
getPermission(action, resource, cb){RBAC}
-
Return instance of Permission by his action and resource
Name |
Type |
Description |
action |
String
|
Name of action |
resource |
String
|
Name of resource |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
-
Return all instances of Permission
Name |
Type |
Description |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
-
Return instance of Role by his name
Name |
Type |
Description |
name |
String
|
Name of role |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
-
Return all instances of Role
Name |
Type |
Description |
cb |
function
|
Callback function |
Returns:
instance of actual RBAC
-
getScope(roleName, cb){RBAC}
-
Return array of all permission assigned to role of RBAC
Name |
Type |
Description |
roleName |
String
|
Name of role |
cb |
function
|
Callback function |
Returns:
instance
-
grant(role, child, cb){RBAC}
-
Grant permission or role to the role
Name |
Type |
Description |
role |
Role
|
Instance of the role |
child |
Role
|
Permission
|
Instance of the role or permission |
cb |
function
|
Callback function |
Returns:
instance
-
grantByName(roleName, childName, cb){RBAC}
-
Grant permission or role from the role by names
Name |
Type |
Description |
roleName |
String
|
Instance of the role |
childName |
String
|
Instance of the role or permission |
cb |
function
|
Callback function |
Returns:
instance
-
-
Grant multiple items in one function
Name |
Type |
Description |
List |
Object
|
of roles |
cb |
function
|
Callback function |
Returns:
instance
-
hasRole(roleName, roleChildName, cb){RBAC}
-
Return true if role has allowed permission
Name |
Type |
Description |
roleName |
String
|
Name of role |
roleChildName |
String
|
Name of child role |
cb |
function
|
Callback function |
Returns:
instance
-
-
Remove role or permission from RBAC
Name |
Type |
Description |
item |
Role
|
Permission
|
Instance of role or permission |
cb |
function
|
Callback function |
Returns:
instance
-
removeByName(name, cb){RBAC}
-
Remove role or permission from RBAC
Name |
Type |
Description |
name |
String
|
Name of role or permission |
cb |
function
|
Callback function |
Returns:
instance
-
revoke(role, child, cb){RBAC}
-
Revoke permission or role from the role
Name |
Type |
Description |
role |
Role
|
Instance of the role |
child |
Role
|
Permission
|
Instance of the role or permission |
cb |
function
|
Callback function |
Returns:
instance
-
revokeByName(roleName, childName, cb){RBAC}
-
Revoke permission or role from the role by names
Name |
Type |
Description |
roleName |
String
|
Instance of the role |
childName |
String
|
Instance of the role or permission |
cb |
function
|
Callback function |
Returns:
instance