Module: AppointmentAuthorization

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/appointment_authorization.rb

Instance Method Summary collapse

Instance Method Details

#authorizeObject (protected)



8
9
10
11
# File 'app/controllers/concerns/appointment_authorization.rb', line 8

def authorize
  raise_access_denied unless current_user.loa3?
  raise_access_denied_no_icn if current_user.icn.blank?
end

#authorize_with_facilitiesObject (protected)



13
14
15
16
# File 'app/controllers/concerns/appointment_authorization.rb', line 13

def authorize_with_facilities
  authorize
  raise_access_denied_no_facilities unless current_user.authorize(:vaos, :facilities_access?)
end

#raise_access_deniedObject (protected)



18
19
20
# File 'app/controllers/concerns/appointment_authorization.rb', line 18

def raise_access_denied
  raise Common::Exceptions::Forbidden, detail: 'You do not have access to online scheduling'
end

#raise_access_denied_no_facilitiesObject (protected)



26
27
28
# File 'app/controllers/concerns/appointment_authorization.rb', line 26

def raise_access_denied_no_facilities
  raise Common::Exceptions::Forbidden, detail: 'No facility associated with user'
end

#raise_access_denied_no_icnObject (protected)



22
23
24
# File 'app/controllers/concerns/appointment_authorization.rb', line 22

def raise_access_denied_no_icn
  raise Common::Exceptions::Forbidden, detail: 'No patient ICN found'
end