Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backend interface for roles management #362

Open
wants to merge 8 commits into
base: rainerd/incorporate-roles-management-code-into-the-core
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add permission set for managing User Roles
This permission set enables the user to manage roles and read users.
the-krg committed Aug 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 3c15ef19c3608103ff816152f60f57fe93fd4fec
1 change: 1 addition & 0 deletions core/lib/spree/permission_sets.rb
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
require 'spree/permission_sets/promotion_management'
require 'spree/permission_sets/restricted_stock_display'
require 'spree/permission_sets/restricted_stock_management'
require 'spree/permission_sets/role_management'
require 'spree/permission_sets/stock_display'
require 'spree/permission_sets/stock_management'
require 'spree/permission_sets/super_user'
15 changes: 15 additions & 0 deletions core/lib/spree/permission_sets/role_management.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module Spree
module PermissionSets
# Permissions for viewing and editing the user roles.
#
# This permission set allows full control over roles, but only allows reading users.
class RoleManagement < PermissionSets::Base
def activate!
can [:read, :admin, :edit, :addresses, :orders, :items], Spree.user_class
can :manage, Spree::Role
end
end
end
end
2 changes: 1 addition & 1 deletion core/lib/spree/permission_sets/user_display.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ class UserDisplay < PermissionSets::Base
def activate!
can [:read, :admin, :edit, :addresses, :orders, :items], Spree.user_class
can [:read, :admin], Spree::StoreCredit
can :read, Spree::Role
can [:read, :admin], Spree::Role
end
end
end