All Projects → seeden → Rbac

seeden / Rbac

Licence: mit
Hierarchical Role Based Access Control for NodeJS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Rbac

Brandenburg
Laravel Authentication Package
Stars: ✭ 79 (-90.78%)
Mutual labels:  authentication, authorization, auth, permissions
Rbac
Hierarchical Role-Based Access Control for Node.js
Stars: ✭ 254 (-70.36%)
Mutual labels:  authorization, rbac, permissions, role
Casbin4D
An authorization library that supports access control models like ACL, RBAC, ABAC in Delphi
Stars: ✭ 25 (-97.08%)
Mutual labels:  permissions, auth, authorization, rbac
Sentinel
A framework agnostic authentication & authorization system.
Stars: ✭ 1,354 (+57.99%)
Mutual labels:  authentication, authorization, auth, permissions
casbin-ex
An authorization library that supports access control models like ACL, RBAC, ABAC in Elixir
Stars: ✭ 37 (-95.68%)
Mutual labels:  auth, authorization, rbac
Php Auth
Authentication for PHP. Simple, lightweight and secure.
Stars: ✭ 713 (-16.8%)
Mutual labels:  authentication, authorization, auth
sequelize-adapter
Sequelize adapter for Casbin
Stars: ✭ 51 (-94.05%)
Mutual labels:  auth, authorization, rbac
Shinobi
👺 Simple and light-weight role-based permissions system for Laravel's built in Auth system.
Stars: ✭ 349 (-59.28%)
Mutual labels:  authentication, auth, permissions
dart-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Dart/Flutter
Stars: ✭ 30 (-96.5%)
Mutual labels:  auth, authorization, rbac
rbac
RBAC - Simple, concurrent Role Based Access Control(GO)
Stars: ✭ 67 (-92.18%)
Mutual labels:  permissions, rbac, role
Gorm Adapter
Gorm adapter for Casbin
Stars: ✭ 373 (-56.48%)
Mutual labels:  authorization, rbac, auth
Aws Serverless Auth Reference App
Serverless reference app and backend API, showcasing authentication and authorization patterns using Amazon Cognito, Amazon API Gateway, AWS Lambda, and AWS IAM.
Stars: ✭ 724 (-15.52%)
Mutual labels:  authentication, authorization, auth
HeimGuard
🛡 A simple library that allows you to easily manage permissions in your .NET projects.
Stars: ✭ 77 (-91.02%)
Mutual labels:  permissions, authorization, role
Casbin.net
An authorization library that supports access control models like ACL, RBAC, ABAC in .NET (C#)
Stars: ✭ 535 (-37.57%)
Mutual labels:  authorization, rbac, auth
objection-authorize
isomorphic, "magical" authorization integration with Objection.js 🎉
Stars: ✭ 71 (-91.72%)
Mutual labels:  authorization, rbac, role
Annon.api
Configurable API gateway that acts as a reverse proxy with a plugin system.
Stars: ✭ 306 (-64.29%)
Mutual labels:  authentication, authorization, auth
Awesome Auth
📊 Software and Libraries for Authentication & Authorization
Stars: ✭ 520 (-39.32%)
Mutual labels:  authentication, authorization, auth
Wetech Admin
wetech-admin是基于Spring Boot 2.0+Mybatis+Vue的轻量级后台管理系统,适用于中小型项目的管理后台,支持按钮级别的权限控制,系统具有最基本的用户管理、角色管理、权限管理等通用性功能,企业或个人可直接在此基础上进行开发,扩展,添加各自的需求和业务功能!
Stars: ✭ 570 (-33.49%)
Mutual labels:  authentication, authorization, rbac
Social Core
Python Social Auth - Core
Stars: ✭ 618 (-27.89%)
Mutual labels:  authentication, authorization, auth
rbac-tool
Rapid7 | insightCloudSec | Kubernetes RBAC Power Toys - Visualize, Analyze, Generate & Query
Stars: ✭ 546 (-36.29%)
Mutual labels:  permissions, authorization, rbac

RBAC

(Hierarchical Role Based Access Control)

NPM version build status Test coverage Gitter chat

RBAC is the authorization library for NodeJS.

🎉 We have supported DynamoDB storage now by implementation of dynamoose.

Motivation

I needed hierarchical role based access control for my projects based on ExpressJS. I had one requirement. This structure must be permanently stored in various storages. For example in memory or Mongoose. Because there is a lot of options for storing of data and many of them are asynchronous. I created asynchronous API. Please, if you found any bug or you need custom API, create an issue or pull request.

Documentation

Read more about API in documentation

Support us

Star this project on GitHub.

Install

npm install rbac

Usage

import { RBAC } from 'rbac'; // ES5 var RBAC = require('rbac').default;
const rbac = new RBAC({
  roles: ['superadmin', 'admin', 'user', 'guest'],
  permissions: {
    user: ['create', 'delete'],
    password: ['change', 'forgot'],
    article: ['create'],
    rbac: ['update'],
  },
  grants: {
    guest: ['create_user', 'forgot_password'],
    user: ['change_password'],
    admin: ['user', 'delete_user', 'update_rbac'],
    superadmin: ['admin'],
  },
});

await rbac.init();

Usage with express

import express from 'express';
import { RBAC } from 'rbac';
import secure from 'rbac/controllers/express';

// your custom controller for express
function adminController(req, res, next) {
  res.send('Hello admin');
}

const app = express();
const rbac = new RBAC({
  roles: ['admin', 'user'],
});

await rbac.init();

// setup express routes
app.use('/admin', secure.hasRole(rbac, 'admin'), adminController);

Check permissions

const can = await rbac.can('admin', 'create', 'article');
if (can) {
  console.log('Admin is able create article');
}

// or you can use instance of admin role
const admin = await rbac.getRole('admin');
if (!admin) {
  return console.log('Role does not exists');
}

const can = await admin.can('create', 'article');
if (can) {
  console.log('Admin is able create article');    
}

Mongoose user model

Please take a look on plugin mongoose-hrbac

Build documentation

npm run doc

Running Tests

npm run test

Build

npm run build

Credits

License

The MIT License (MIT)

Copyright (c) 2016-2018 Zlatko Fedor [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].