Class: Spree::PermissionSets::Base

Inherits:
Object
  • Object
show all
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

See Also:

Direct Known Subclasses

ConfigurationDisplay, ConfigurationManagement, DashboardDisplay, DefaultCustomer, OrderDisplay, OrderManagement, ProductDisplay, ProductManagement, PromotionDisplay, PromotionManagement, ReportDisplay, RestrictedStockDisplay, RestrictedStockManagement, RestrictedStockTransferDisplay, RestrictedStockTransferManagement, StockDisplay, StockManagement, StockTransferDisplay, StockTransferManagement, SuperUser, UserDisplay, UserManagement

Instance Method Summary (collapse)

Constructor Details

- (Base) initialize(ability)

Returns a new instance of Base

Parameters:

  • ability (CanCan::Ability)

    The ability that will be extended with the current permission set. The ability passed in must respond to #user



14
15
16
# File 'lib/spree/permission_sets/base.rb', line 14

def initialize(ability)
  @ability = ability
end

Instance Method Details

- (Object) activate!

Activate permissions on the ability. Put your can and cannot statements here. Must be overriden by subclasses

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/spree/permission_sets/base.rb', line 20

def activate!
  raise NotImplementedError.new
end