Code Monkey home page Code Monkey logo

rbac's Introduction

Role Based Access Control

Role Based Access Control implemented in this repository is based on users, roles, resources, and permissions. This is purely a demo project, but is aimed at making it extensible to anything as a resource, and any action associated with it. We have three models

1. User
2. Role
3. Resource

The following relation ships bind the resources,users and roles

1. User-Role
2. Resource-Role (permissions)

Resource-Role is basically a permission model, with an additional json column, stating its permissions. It is basically inspired by Amazon Web Services' way of modeling access control, by way of users, policies and user-policy mapping. A policy is nothing but a json document stating the access level. Instead of having an policy framework, we have resources, and permissions which tell what actions are allowed for which role.

Assumptions

  1. Assuming that there will be some admin panel to add resources, roles and users and also allocate permissions, have made only a nominal API for Users, Roles and Resources
  2. Have made a middleware to check RBAC. However the access control check can be done at any level, a middleware is made and routes specify which action and resource is used to access the route

Installation

  • php installation
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php 
sudo apt-get update
sudo apt-get install php7.0-fpm php7.0-mysql php7.0-curl php7.0-mcrypt php7.0-mbstring php7.0-xml php-xdebug whois
php -v #should reflect version 7
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
  • Mysql 5.7 installation
wget https://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
dpkg -i mysql-apt-config_0.6.0-1_all.deb #select MySQL 5.7 if not already selected and apply.
sudo apt-get install mysql-server
mysqladmin -u root -p version
  • Project space setup
git clone [email protected]:somiithm/RBAC.git <folder name>
cd <folder name>
composer install
cp .env.example .env
php artisan migrate
php artisan db:seed
php artisan serve

.env must have all the right credentials to access Mysql 5.7

please make sure to make a new Database in mysql before running steps from php artisan migrate and later

Users Created by DB seeding

  • Admin
email - [email protected]
password - Admin
  • ReadUser
email - [email protected]
password - ReadUser
  • WriteUser
email - [email protected]
password - WriteUser
  • DeleteUser
email - [email protected]
password - DeleteUser
  • ReadWriteUser
email - [email protected]
password - ReadWriteUser

rbac's People

Watchers

Som Bose avatar

rbac's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.