forked from solidusio/solidus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PermissionSet, RolePermission models
This is building off of the new migrations in solidusio#5833 These originate from `solidus_user_roles`. We intend to migrate some of the functionality from that extension into `core`, and this is the (second) step. Co-authored-by: benjamin wil <[email protected]>
- Loading branch information
1 parent
d81043a
commit ba1081b
Showing
3 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Spree | ||
class PermissionSet < Spree::Base | ||
has_many :role_permissions | ||
has_many :roles, through: :role_permissions | ||
validates :name, :set, presence: true | ||
scope :display_permissions, -> { where('name LIKE ?', '%Display') } | ||
scope :management_permissions, -> { where('name LIKE ?', '%Management') } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
module Spree | ||
class RolePermission < Spree::Base | ||
belongs_to :role | ||
belongs_to :permission_set | ||
end | ||
end |