This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from nyambati/develop
# Merge Develop to master
- Loading branch information
Showing
16 changed files
with
4,219 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ node_modules | |
examples/node_modules | ||
coverage | ||
site | ||
.DS_Store | ||
.DS_Store | ||
env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Api Methods | ||
|
||
## authorize | ||
[type: middleware] | ||
|
||
This is the middleware that manages your application requests based on the role and acl rules. | ||
|
||
```js | ||
app.get(acl.authorize); | ||
|
||
``` | ||
|
||
## unless | ||
[type:function, params: function or object] | ||
|
||
By default any route that has no defined policy against it is blocked, this means you cannot access this route untill you specify a policy. | ||
This method enables you to exclude unprotected routes. This method uses express-unless package to achive this functionality. | ||
For more details on its usage follow this link [express-unless](https://github.com/jfromaniello/express-unless/blob/master/README.md) | ||
|
||
```js | ||
//assuming we want to hide /auth/google from express acl | ||
|
||
app.use(acl.authorize.unless({path:['/auth/google']})); | ||
|
||
``` | ||
|
||
Anytime that this route is visited, unless method will exlude it from being passed though our middleware. | ||
|
||
!!! note | ||
You don't have to install express-unless it has already been included into the project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
[{ | ||
"group": "user", | ||
"permissions": [{ | ||
"resource": "users", | ||
"methods": [ | ||
"POST", | ||
"GET", | ||
"PUT" | ||
], | ||
"action": "allow" | ||
}] | ||
}] | ||
[ | ||
{ | ||
"group": "admin", | ||
"permissions": [ | ||
{ | ||
"resource": "*", | ||
"methods": "*", | ||
"action": "allow" | ||
} | ||
] | ||
}, | ||
{ | ||
"group": "user1", | ||
"permissions": [ | ||
{ | ||
"resource": "admin", | ||
"methods": "*", | ||
"action": "deny" | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.