Class: Spree::PermissionSets::Base
- Inherits:
-
Object
- Object
- Spree::PermissionSets::Base
- Defined in:
- lib/spree/permission_sets/base.rb
Overview
This is the base class used for crafting permission sets.
This is used by RoleConfiguration when adding custom behavior to Ability. See one of the subclasses for example structure such as UserDisplay
Direct Known Subclasses
ConfigurationDisplay, ConfigurationManagement, DashboardDisplay, DefaultCustomer, OrderDisplay, OrderManagement, ProductDisplay, ProductManagement, RestrictedStockDisplay, RestrictedStockManagement, StockDisplay, StockManagement, SuperUser, UserDisplay, UserManagement
Class Method Summary collapse
-
.category ⇒ Object
Provide the permission set category in the form of a :symbol.
-
.privilege ⇒ Object
Provide the permission set privilege in the form of a :symbol.
Instance Method Summary collapse
-
#activate! ⇒ Object
Activate permissions on the ability.
-
#initialize(ability) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(ability) ⇒ Base
Returns a new instance of Base.
16 17 18 |
# File 'lib/spree/permission_sets/base.rb', line 16 def initialize(ability) @ability = ability end |
Class Method Details
.category ⇒ Object
Provide the permission set category in the form of a :symbol. Must be overridden by subclasses.
34 35 36 |
# File 'lib/spree/permission_sets/base.rb', line 34 def self.category raise NotImplementedError, "Subclass #{name} must define a category using `self.category :symbol`" end |
.privilege ⇒ Object
Provide the permission set privilege in the form of a :symbol. Must be overridden by subclasses.
28 29 30 |
# File 'lib/spree/permission_sets/base.rb', line 28 def self.privilege raise NotImplementedError, "Subclass #{name} must define a privilege using `self.privilege :symbol`" end |
Instance Method Details
#activate! ⇒ Object
Activate permissions on the ability. Put your can and cannot statements here. Must be overridden by subclasses
22 23 24 |
# File 'lib/spree/permission_sets/base.rb', line 22 def activate! raise NotImplementedError.new end |