1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(bug) cant load order withdrawal instructions if no login

This commit is contained in:
Du Peng 2022-10-13 17:57:26 +02:00
parent ef3b876bd0
commit 9834faf120
2 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
# API Controller for resources of type Order
# Orders are used in store
class API::OrdersController < API::ApiController
before_action :authenticate_user!
before_action :authenticate_user!, except: %i[withdrawal_instructions]
before_action :set_order, only: %i[show update destroy withdrawal_instructions]
def index

View File

@ -15,6 +15,6 @@ class OrderPolicy < ApplicationPolicy
end
def withdrawal_instructions?
user.privileged? || (record&.statistic_profile_id == user.statistic_profile.id)
user&.privileged? || (record&.statistic_profile_id == user&.statistic_profile&.id)
end
end