summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/solidus_subscriptions/permission_sets/subscription_management.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/solidus_subscriptions/permission_sets/subscription_management.rb b/lib/solidus_subscriptions/permission_sets/subscription_management.rb
index 8f5edfb..76c1e94 100644
--- a/lib/solidus_subscriptions/permission_sets/subscription_management.rb
+++ b/lib/solidus_subscriptions/permission_sets/subscription_management.rb
@@ -5,12 +5,11 @@ module SolidusSubscriptions
class SubscriptionManagement < ::Spree::PermissionSets::Base
def activate!
can :manage, Subscription do |subscription|
- subscription.user == user
+ subscription.user && subscription.user == user
end
- can :manage, LineItem do |line_item, order|
- (line_item.order && line_item.order == order) ||
- (line_item.order&.user && line_item.order.user == user)
+ can :manage, LineItem do |line_item|
+ line_item.subscription&.user && line_item.subscription.user == user
end
end
end