refactoring acl

This commit is contained in:
les
2021-05-19 16:38:22 +02:00
parent c6cb98f502
commit 81932c6e88
3 changed files with 29 additions and 17 deletions

View File

@@ -41,9 +41,12 @@ const Auth = {
hasPerm (scope) {
return (req, res, next) => {
log.debug(scope, req.path)
oauth.oauthServer.authenticate({ scope })(req, res, () => {
log.debug('has perm')
next()
oauth.oauthServer.authenticate({ scope })(req, res, err => {
if (err) {
next()
} else {
next(Error(err))
}
})
}
}