adonis-imperium
Advanced tools
Comparing version 0.3.1 to 0.4.0
{ | ||
"name": "adonis-imperium", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "This package is an **authorization provider** built on top of [imperium](https://github.com/mono-js/imperium).", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -15,3 +15,3 @@ 'use strict' | ||
if (await imperium.cannot(action, actionParams)) throw new AuthorizationException('Unauthorized', 401, 'E_UNAUTHORIZED') | ||
if (await imperium.cannot(action, actionParams)) throw new AuthorizationException('Unauthorized', 403, 'E_UNAUTHORIZED') | ||
@@ -22,3 +22,3 @@ await next() | ||
async wsHandle ({ imperium }, next, [action]) { | ||
if (await imperium.cannot(action)) throw new AuthorizationException('Unauthorized', 401, 'E_UNAUTHORIZED') | ||
if (await imperium.cannot(action)) throw new AuthorizationException('Unauthorized', 403, 'E_UNAUTHORIZED') | ||
@@ -25,0 +25,0 @@ await next() |
@@ -7,3 +7,3 @@ 'use strict' | ||
async handle ({ imperium }, next, [role]) { | ||
if (await imperium.isnot(role)) throw new AuthorizationException('Unauthorized', 401, 'E_UNAUTHORIZED') | ||
if (await imperium.isnot(role)) throw new AuthorizationException('Unauthorized', 403, 'E_UNAUTHORIZED') | ||
@@ -14,3 +14,3 @@ await next() | ||
async wsHandle ({ imperium }, next, [role]) { | ||
if (await imperium.isnot(role)) throw new AuthorizationException('Unauthorized', 401, 'E_UNAUTHORIZED') | ||
if (await imperium.isnot(role)) throw new AuthorizationException('Unauthorized', 403, 'E_UNAUTHORIZED') | ||
@@ -17,0 +17,0 @@ await next() |