new TheSortingHat(hatAdapter)
Parameters:
| Name | Type | Description |
|---|---|---|
hatAdapter |
HatAdapter | an instance of HatAdapter is required. |
- Source:
Throws:
-
When given argument is not an instance of HatAdapter
- Type
- TypeError
Methods
-
addGroup(group, callback)
-
Add a group (Is delegated to a given adapter)
Parameters:
Name Type Description groupobject Group to add
callbackfunction - Source:
-
addGroups(groups, callback)
-
Adds an array of groups (Is delegated to a given adapter)
Parameters:
Name Type Description groupsArray.<object> Collection of groups to add
callbackfunction - Source:
-
addPermission(permission, callback)
-
Add a permission (Is delegated to a given adapter)
Parameters:
Name Type Description permissionobject Permission to add
callbackfunction - Source:
-
addPermissions(permissions, callback)
-
Adds an array of permissions to the initialized adapter (Is delegated to a given adapter)
Parameters:
Name Type Description permissionsArray.<object> Collection of permissions to add
callbackfunction - Source:
-
addUser(user, callback)
-
Adds a user (Is delegated to a given adapter)
Parameters:
Name Type Description userobject User to add
callbackfunction - Source:
-
findGroup(criteria, callback)
-
Finds a group (Is delegated to a given adapter)
Parameters:
Name Type Description criteriaobject Group to find
callbackfunction - Source:
-
findGroupsByUser(user, callback)
-
Finds a group collection attached to this certain user (Is delegated to a given adapter)
Parameters:
Name Type Description userobject User criteria to find the corresponding groups
callbackfunction - Source:
-
findPermission(criteria, callback)
-
Finds a permission (Is delegated to a given adapter)
Parameters:
Name Type Description criteriaobject Permission to find
callbackfunction - Source:
-
findPermissionsByUser(user, callback)
-
Finds a permission collection attached to this certain user (Is delegated to a given adapter)
Parameters:
Name Type Description userobject User criteria to find the corresponding permissions
callbackfunction - Source:
-
findUser(criteria, callback)
-
Finds a user (Is delegated to a given adapter)
Parameters:
Name Type Description criteriaobject User to find
callbackfunction - Source:
-
initialize(callback)
-
Initializes The Sorting Hat (it initializes the given adapter)
Parameters:
Name Type Description callbackfunction - Source:
-
removeGroup(group, callback)
-
Removes a group (Is delegated to a given adapter)
Parameters:
Name Type Description groupobject Group criteria for removal of a certain group
callbackfunction - Source:
-
removePermission(permission, callback)
-
Removes a permission (Is delegated to a given adapter)
Parameters:
Name Type Description permissionobject Permission criteria for removal of a certain permission
callbackfunction - Source:
-
removeUser(user, callback)
-
Removes a user (Is delegated to a given adapter)
Parameters:
Name Type Description userobject User criteria for removal of a certain user
callbackfunction - Source:
-
upsertGroup(criteria, group, callback)
-
Updates an existing group, and if not found inserts the group (Is delegated to a given adapter)
Parameters:
Name Type Description criteriaobject Group criteria to update when found
groupobject Data to merge with existing group, or to insert
callbackfunction - Source:
-
upsertPermission(criteria, permission, callback)
-
Updates an existing permission, and if not found inserts the permission (Is delegated to a given adapter)
Parameters:
Name Type Description criteriaobject Permission criteria to update when found
permissionobject Data to merge with existing permission, or to insert
callbackfunction - Source:
-
upsertUser(criteria, user, callback)
-
Updates an existing user, and if not found inserts the user (Is delegated to a given adapter)
Parameters:
Name Type Description criteriaobject User criteria to update when found
userobject Data to merge with existing user, or to insert
callbackfunction - Source:
-
validateUserWithAllPermissions(user, permissions, callback)
-
Validates given user against given array of permission positions. All given permissions need to be found at this given user (Is delegated to a given adapter)
Parameters:
Name Type Description userobject User as criteria to validate
permissionsArray.<Number> callbackfunction - Source:
-
validateUserWithAnyPermissions(user, permissions, callback)
-
Validates given user against given array of permission positions. If any given permission is found attached to this given user (Is delegated to a given adapter)
Parameters:
Name Type Description userobject User to validate permissions against
permissionsArray.<Number> Permission collection of integers
callbackfunction - Source: