Class: Spree::PermissionSets::ConfigurationManagement

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/permission_sets/configuration_management.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/models/spree/permission_sets/configuration_management.rb', line 12

def activate!
  # Store settings
  can :manage, Spree::Store

  # Payment configuration
  can :manage, Spree::PaymentMethod
  can :manage, Spree::Gateway

  # Shipping configuration
  can :manage, Spree::ShippingMethod
  can :manage, Spree::ShippingCategory
  can :manage, Spree::Zone
  can :manage, Spree::ZoneMember

  # Markets — Channel / Market is the long-term replacement for
  # Zone (see docs/plans/6.0-tax-provider.md), but both coexist
  # during the migration and need admin read/write either way.
  can :manage, Spree::Market

  # Tax configuration
  can :manage, Spree::TaxCategory
  can :manage, Spree::TaxRate

  # CORS allowlist used by Rack::Cors + admin cookie auth (see
  # docs/plans/5.5-admin-auth-cookie-refresh.md).
  can :manage, Spree::AllowedOrigin

  # Webhooks
  can :manage, Spree::WebhookEndpoint
  can :manage, Spree::WebhookDelivery

  # General configuration
  can :manage, Spree::RefundReason
  can :manage, Spree::ReimbursementType
  can :manage, Spree::ReturnReason

  # Channels
  can :manage, Spree::Channel

  # Restrictions on immutable types
  cannot [:edit, :update], Spree::RefundReason, mutable: false
  cannot [:edit, :update], Spree::ReimbursementType, mutable: false

  # Metafield configuration
  can :manage, Spree::MetafieldDefinition

  # Policies
  can :manage, Spree::Policy
end