Class: Spree::PermissionSets::SuperUser

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/permission_sets/super_user.rb

Instance Attribute Summary

Attributes inherited from Base

#ability

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Spree::PermissionSets::Base

Instance Method Details

#activate!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/spree/permission_sets/super_user.rb', line 12

def activate!
  can :manage, :all

  # Safety restrictions
  cannot :cancel, Spree::Order
  can :cancel, Spree::Order, &:allow_cancel?
  cannot :destroy, Spree::Order
  can :destroy, Spree::Order, &:can_be_deleted?
  cannot [:edit, :update], Spree::RefundReason, mutable: false
  cannot [:edit, :update], Spree::ReimbursementType, mutable: false

  # Protect the admin role from modification
  cannot [:update, :destroy], Spree::Role, name: ['admin']
end