diff options
Diffstat (limited to 'lib/solidus_subscriptions/ability.rb')
-rw-r--r-- | lib/solidus_subscriptions/ability.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/solidus_subscriptions/ability.rb b/lib/solidus_subscriptions/ability.rb index 6ce4b2d..55b6344 100644 --- a/lib/solidus_subscriptions/ability.rb +++ b/lib/solidus_subscriptions/ability.rb @@ -5,15 +5,13 @@ module SolidusSubscriptions include CanCan::Ability def initialize(user) - alias_action :create, :read, :update, :destroy, to: :crud - if user.has_spree_role?('admin') can(:manage, LineItem) can(:manage, Subscription) else - can([:crud, :skip, :cancel], Subscription, user_id: user.id) - can(:crud, LineItem) do |li, order| - li.order.user == user || li.order == order + can([:index, :show, :create, :update, :destroy, :skip, :cancel], Subscription, user_id: user.id) + can([:index, :show, :create, :update, :destroy], LineItem) do |line_item, order| + line_item.order.user == user || line_item.order == order end end end |