summaryrefslogtreecommitdiff
path: root/lib/solidus_subscriptions
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-10-08 16:38:22 +0200
committerAlessandro Desantis <desa.alessandro@gmail.com>2020-10-08 16:54:45 +0200
commitf55ce37d3d28d7c18b8458b657431bb7c07ac4a1 (patch)
tree3496c715eb6d8a1baf63b43f520d85f262fd3109 /lib/solidus_subscriptions
parent4bafb311fe180f3cc0bb38f01f24f2b487e8be8b (diff)
Add scope to subscription permissions
With an AR scope, `#accessible_by` can be properly used.
Diffstat (limited to 'lib/solidus_subscriptions')
-rw-r--r--lib/solidus_subscriptions/permission_sets/subscription_management.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/solidus_subscriptions/permission_sets/subscription_management.rb b/lib/solidus_subscriptions/permission_sets/subscription_management.rb
index c669368..9077ab9 100644
--- a/lib/solidus_subscriptions/permission_sets/subscription_management.rb
+++ b/lib/solidus_subscriptions/permission_sets/subscription_management.rb
@@ -4,7 +4,7 @@ module SolidusSubscriptions
module PermissionSets
class SubscriptionManagement < ::Spree::PermissionSets::Base
def activate!
- can :manage, Subscription do |subscription, guest_token|
+ can :manage, Subscription, Subscription.where(user: user) do |subscription, guest_token|
(subscription.guest_token.present? && subscription.guest_token == guest_token) ||
(subscription.user && subscription.user == user)
end