summaryrefslogtreecommitdiff
path: root/lib/solidus_subscriptions
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-10-07 16:33:01 +0200
committerAlessandro Desantis <desa.alessandro@gmail.com>2020-10-07 16:33:44 +0200
commit6cfe54f911648e46da4e65face658ce4f91c491f (patch)
tree6ffaade6a0db2b3666677854c00f9e16cb084420 /lib/solidus_subscriptions
parentae1b46fe30793cecb13a8591e9d753ada9f89039 (diff)
Simplify line item management permissions
It isn't possible to manage line items through an order anymore, so we can greatly simplify the permission set.
Diffstat (limited to 'lib/solidus_subscriptions')
-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