new Noun(name) → {noun}
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of noun |
Returns:
- the created noun
- Type
- noun
Methods
authorize(role, verbs)
Authorizes a role to perform a verb.
Parameters:
Name | Type | Description |
---|---|---|
role |
string | |
verbs |
Array.<string> | string | Either the string '*', which authorizes all possible verbs to the given role, or an array of verbs to authorize. |
checkAuthorization(role, verb) → {boolean}
Checks if a role is regestered and it has the permission
Parameters:
Name | Type | Description |
---|---|---|
role |
string | |
verb |
string |
Returns:
- Type
- boolean
hasVerb(verb) → {Boolean}
Checks to see if noun has verb
Parameters:
Name | Type | Description |
---|---|---|
verb |
string |
Returns:
- Type
- Boolean
removeVerb(verb)
Removes a verb from the set of possible verbs. Useful for removing default crud.
Parameters:
Name | Type | Description |
---|---|---|
verb |
string |
verb(verb)
Adds verb to the set of posible verbs that can be authorized. For example, post.can('like')
would add the verb 'like' to a noun 'post'
Parameters:
Name | Type | Description |
---|---|---|
verb |
string |