All Projects → vinsol-spree-contrib → spree_admin_roles_and_access

vinsol-spree-contrib / spree_admin_roles_and_access

Licence: BSD-3-Clause license
Admin Roles And Access for Spree

Programming Languages

ruby
36898 projects - #4 most used programming language
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to spree admin roles and access

Laravel Governor
Manage authorization with granular role-based permissions in your Laravel Apps.
Stars: ✭ 131 (+191.11%)
Mutual labels:  permissions, roles
Think Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in ThinkPHP 6.0 .
Stars: ✭ 155 (+244.44%)
Mutual labels:  permissions, roles
Laratrust
Handle roles and permissions in your Laravel application
Stars: ✭ 1,799 (+3897.78%)
Mutual labels:  permissions, roles
React-Express-JWT-UserPortal
React.js & Express.js User portal Using Core UI, JWT, JWT Token, Refresh Token, Role & Permission management, User manamgenet, Event Log.
Stars: ✭ 22 (-51.11%)
Mutual labels:  permissions, roles
Bouncer
Eloquent roles and abilities.
Stars: ✭ 2,763 (+6040%)
Mutual labels:  permissions, roles
Accesscontrol
Role and Attribute based Access Control for Node.js
Stars: ✭ 1,723 (+3728.89%)
Mutual labels:  permissions, roles
nova-permissions
Add Permissions based authorization for your Nova installation via User-based Roles and Permissions. Roles are defined in the database whereas Permissions are defined in the code base.
Stars: ✭ 115 (+155.56%)
Mutual labels:  permissions, roles
Django Role Permissions
A django app for role based permissions.
Stars: ✭ 465 (+933.33%)
Mutual labels:  permissions, roles
Vue Router User Roles
A Vue.js plugin that protects routes based on user roles. Add your own authentication.
Stars: ✭ 237 (+426.67%)
Mutual labels:  permissions, roles
Adonis Acl
demo app: https://github.com/enniel/adonis-acl-blog-demo
Stars: ✭ 195 (+333.33%)
Mutual labels:  permissions, roles
Sentinel
A framework agnostic authentication & authorization system.
Stars: ✭ 1,354 (+2908.89%)
Mutual labels:  permissions, roles
ngx-access
Add access control to your components using hierarchical configuration with logical expressions.
Stars: ✭ 21 (-53.33%)
Mutual labels:  permissions, roles
Brandenburg
Laravel Authentication Package
Stars: ✭ 79 (+75.56%)
Mutual labels:  permissions, roles
Laravel Auth
A powerful authentication, authorization and verification package built on top of Laravel. It provides developers with Role Based Access Control, Two-Factor Authentication, Social Authentication, and much more, compatible Laravel’s standard API and fully featured out of the box.
Stars: ✭ 128 (+184.44%)
Mutual labels:  permissions, roles
Ngx Permissions
Permission and roles based access control for your angular(angular 2,4,5,6,7,9+) applications(AOT, lazy modules compatible
Stars: ✭ 749 (+1564.44%)
Mutual labels:  permissions, roles
Maravel Permissions
Because in the Maravelous univer every user deserves super power
Stars: ✭ 139 (+208.89%)
Mutual labels:  permissions, roles
Shinobi
👺 Simple and light-weight role-based permissions system for Laravel's built in Auth system.
Stars: ✭ 349 (+675.56%)
Mutual labels:  permissions, roles
Policyserver.local
Sample OSS version of PolicyServer
Stars: ✭ 444 (+886.67%)
Mutual labels:  permissions, roles
Vue Gates
🔒 A Vue.js & Nuxt.js plugin that allows you to use roles and permissions in your components or DOM elements, also compatible as middleware and methods.
Stars: ✭ 184 (+308.89%)
Mutual labels:  permissions, roles
rbac
Simple RBAC/ACL for Laravel 8 caching and permission groups.
Stars: ✭ 43 (-4.44%)
Mutual labels:  permissions, roles

SpreeAdminRolesAndAccess Code Climate Build Status

This spree extension is built on CanCan to dynamically add new roles and define its access through permissions.

Demo

Try Spree Admin Roles and Access for Spree master with direct deployment on Heroku:

Deploy

Try Spree Admin Roles and Access for Spree 4-1 with direct deployment on Heroku:

Deploy

Try Spree Admin Roles and Access for Spree 3-4 with direct deployment on Heroku:

Deploy

Try Spree Admin Roles and Access for Spree 3-1 with direct deployment on Heroku:

Deploy

Screenshots

Permission Sets Roles

Installation

Add spree_admin_roles_and_access to your Gemfile:

Spree >= 3.2

gem 'spree_admin_roles_and_access', github: 'vinsol-spree-contrib/spree_admin_roles_and_access'

Spree < 3.2

gem 'spree_admin_roles_and_access', github: 'vinsol-spree-contrib/spree_admin_roles_and_access', branch: 'X-X-stable'

Note Please use 3-1-stable-updated branch for spree-3-1

Bundle your dependencies and run the installation generator:

bundle
bundle exec rails g spree_admin_roles_and_access:install
bundle exec rake spree_roles:permissions:populate # To populate user and admin roles with their permissions
bundle exec rake spree_roles:permissions:populate_permission_sets # To set up some convenient permission sets.

Usage

From Admin end, There are three menu's in the configuration Tab:

  1. Permission: Describes what the user can do.
  2. Permission Set: A collection of permission describing an aspect of role.
  3. Role: Collection of multiple permission sets which describe the role of user in the organisation. A role can be marked as admin_accessible in the role edit page. A role marked as such will get a default admin dashboard page in case they land on an admin page on which they do not have access.

Types of Permission

  1. Default Permission - Basic permissions required by a user to perform task on user end, like creating an order etc. Every role should be provided with this permissions.
  2. Can Manage All - Role with this permission can do everything. This permission is also invisible at admin end. And it should only be given to admin and super admin.
  3. Resource Manage Permission - Each Resource has an associated admin permission that is required for accessing it. i.e. can-admin-spree/products
  4. Resource Permission - What the user is allowed to do with the resource. i.e. Create, Update, Delete, List or Show.

Pattern of the permissions

  1. Can/cannot - specifies whether the user with that permission can do or cannot do that task.
  2. Action - specifies the action which can be done by that model or subject like update, index, create etc. There is a special action called manage which matches every action.
  3. Subject - specified the model like products, users etc. of which the permission is given. There is an special subject called all which matches every subject.
  4. Attributes - specifies the attributes for which the permission is specified. Read-only actions shouldn't require this like index, read etc. But it is more secure if we specify them in other actions like create or update.

Some Examples

  1. can-manage-spree/product - can perform every action on Spree::Product but not on any other model or subject.
  2. can-update-all - can update all models or subjects.
  3. can-update-spree/product - can update only products, and not users, orders and other things.
  4. can-update-spree/product-price - can update only price of products.
  5. can-manage-all - can perform every action on all models.

Permission Sets

Once permissions are created you can organize groups of them into permission sets, These permission sets can then be assigned to the user's role which requires them.

Points to remember

  1. If the controller doesn't have any model associated with it, then we will provide the full controller path like :- can-read-spree/admin/pos

  2. Every Role should also have admin permission of that particular controller. For eg:- To create a product, can-admin-spree/product is also needed along with can-create-spree/product.

  3. To define custom cancan permissions, which can not be made with the pattern adopted. Override the module Permission. And define the permission in a method, and create a permission in the database. See example of default-permission.

Migration from older version

v3.2.1 introduces some breaking changes.

After updating the gem version. Run rails g spree_admin_roles_and_access:install to get the latest migrations. This includes a migration that generates a permission set per user role. With this, you should be able to continue using the original roles as you were earlier.

Additionally you may want to run the rake task populate_permission_sets to seed some initial permission sets. You can now gradually opt into seperating user role permissions into appropriate permission sets.

The original relationship between roles and permissions can be accessed via, legacy_roles & legacy_permissions. They are not supported or editable via the admin interfaces and are only mantained for use in our migration task.

Note in the previous version read action was only for show. That has been superseded by read action now implying both show and index.

Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

bundle
bundle exec rake test_app
bundle exec rspec spec

For older versions of spree

If you are using older version of spree. You can use the following version, please check the relavent readme for version specific installation guide.

# Spree 2.4.0-rc3
gem 'spree_admin_roles_and_access', '1.3.0'
# Spree 2.1.x
gem 'spree_admin_roles_and_access', '1.1.0'
# Spree 2.0.x
gem 'spree_admin_roles_and_access', '1.0.0'

See It In Action

Youtube Video Tutorial

Contributing

  1. Fork the repo.
  2. Clone your repo.
  3. Run bundle install.
  4. Run bundle exec rake test_app to create the test application in spec/test_app.
  5. Make your changes.
  6. Ensure specs pass by running bundle exec rspec spec.
  7. Submit your pull request.

Credits

vinsol.com: Ruby on Rails, iOS and Android developers

Copyright (c) 2017 vinsol.com, released under the New MIT License

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].