summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlessandro Desantis <desa.alessandro@gmail.com>2020-10-21 12:06:58 +0200
committerGitHub <noreply@github.com>2020-10-21 12:06:58 +0200
commitdb9913f3b186b0be11976d1daf315d84057e4216 (patch)
treece2d34f99b4042203167ac0942fa378d2f1363e0 /lib
parent8ff161a4b02d395ec81f9f6331e0e11f8e81363c (diff)
parent1b759f489ae559820d84050c60e578f11816667d (diff)
Merge pull request #161 from solidusio-contrib/aldesantis/fix-default-customer-permissions
Fix DefaultCustomer permission set giving guests access to admin
Diffstat (limited to 'lib')
-rw-r--r--lib/solidus_subscriptions/permission_sets/default_customer.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/solidus_subscriptions/permission_sets/default_customer.rb b/lib/solidus_subscriptions/permission_sets/default_customer.rb
index df9845e..ebe888e 100644
--- a/lib/solidus_subscriptions/permission_sets/default_customer.rb
+++ b/lib/solidus_subscriptions/permission_sets/default_customer.rb
@@ -4,12 +4,12 @@ module SolidusSubscriptions
module PermissionSets
class DefaultCustomer < ::Spree::PermissionSets::Base
def activate!
- can :manage, Subscription, ['user_id = ?', user.id] do |subscription, guest_token|
+ can [:display, :update, :skip, :cancel], Subscription, ['user_id = ?', user.id] do |subscription, guest_token|
(subscription.guest_token.present? && subscription.guest_token == guest_token) ||
(subscription.user && subscription.user == user)
end
- can :manage, LineItem do |line_item, guest_token|
+ can [:display, :update, :destroy], LineItem do |line_item, guest_token|
(line_item.subscription&.guest_token.present? && line_item.subscription.guest_token == guest_token) ||
(line_item.subscription&.user && line_item.subscription.user == user)
end