Class: MHVPrescriptionsPolicy
- Inherits:
-
Struct
- Object
- Struct
- MHVPrescriptionsPolicy
- Defined in:
- app/policies/mhv_prescriptions_policy.rb
Constant Summary collapse
- RX_ACCOUNT_TYPES =
%w[Premium Advanced].freeze
Instance Attribute Summary collapse
-
#mhv_prescriptions ⇒ Object
Returns the value of attribute mhv_prescriptions.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#access? ⇒ Boolean
NOTE: This check for va_patient, might break functionality for mhv-sign-in users, since we only query MVI for “Premium”, and Rx is technically available to non-premium.
Instance Attribute Details
#mhv_prescriptions ⇒ Object
Returns the value of attribute mhv_prescriptions
3 4 5 |
# File 'app/policies/mhv_prescriptions_policy.rb', line 3 def mhv_prescriptions @mhv_prescriptions end |
#user ⇒ Object
Returns the value of attribute user
3 4 5 |
# File 'app/policies/mhv_prescriptions_policy.rb', line 3 def user @user end |
Instance Method Details
#access? ⇒ Boolean
NOTE: This check for va_patient, might break functionality for mhv-sign-in users, since we only query MVI for “Premium”, and Rx is technically available to non-premium.
8 9 10 11 12 |
# File 'app/policies/mhv_prescriptions_policy.rb', line 8 def access? service_name = user.identity.sign_in[:service_name] RX_ACCOUNT_TYPES.include?(user.mhv_account_type) && (user.va_patient? || service_name == SignIn::Constants::Auth::MHV) end |