New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

adonis-imperium

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-imperium - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "adonis-imperium",
"version": "0.1.0",
"version": "0.1.1",
"description": "This package is an **authorization provider** built on top of [imperium](https://github.com/mono-js/imperium).",

@@ -5,0 +5,0 @@ "repository": {

@@ -1,4 +0,4 @@

# Adonis Imperium 🦅
# Adonis Imperium
This package is an **authorization provider** built on top of [imperium](https://github.com/mono-js/imperium).
This package is an **authorization provider** built on top of [imperium](https://github.com/mono-js/imperium) and inspired by [adonis-guard](https://github.com/RomainLanz/adonis-guard).

@@ -40,2 +40,8 @@ ## Getting Started

Imperium.role('Moderator', async () => {
const posts = await Post.query().fetch()
return posts.toJSON().map((post) => ({ post: post.id }))
})
Imperium.role('User', async ({ auth }) => {

@@ -117,3 +123,3 @@ return { user: auth.user.id }

**Public API**
### API

@@ -120,0 +126,0 @@ ```js

'use strict'
/* global use */
const AuthorizationException = require('../Exceptions')

@@ -15,3 +17,3 @@

if (await imperium.cannot(action, actionParams)) throw AuthorizationException.invoke('Unauthorized', 401, 'E_UNAUTHORIZED')
if (await imperium.cannot(action, actionParams)) throw new AuthorizationException('Unauthorized', 401, 'E_UNAUTHORIZED')

@@ -18,0 +20,0 @@ await next()

'use strict'
/* global use */
const Imperium = use('Imperium')

@@ -4,0 +6,0 @@

@@ -7,3 +7,3 @@ 'use strict'

async handle ({ imperium }, next, [role]) {
if (await imperium.isnot(role)) throw AuthorizationException.invoke('Unauthorized', 401, 'E_UNAUTHORIZED')
if (await imperium.isnot(role)) throw new AuthorizationException('Unauthorized', 401, 'E_UNAUTHORIZED')

@@ -10,0 +10,0 @@ await next()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc