capabilities module
This module checks the capabilities of a user
- Source:
Methods
(static) check(user, cap)
Checks capabilities of a user.
All users have an access property, which is a Number. When a string
is passed in to cap, that string will be compared against the
data/capabilities object to translate that string into a number. The
number of the user access and the number of the capabilities are compared.
If the user's access meets or exceeds the cooresponding capability number,
true is returned. Else, false is returned.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
user |
Object | user object
Properties
|
||||||
cap |
String | capability name |
- Source:
Returns:
true if the user's access meets the capability level, else false