Class: MHVPrescriptionsPolicy

Inherits:
Struct
  • Object
show all
Defined in:
app/policies/mhv_prescriptions_policy.rb

Constant Summary collapse

RX_ACCOUNT_TYPES =
%w[Premium Advanced].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mhv_prescriptionsObject

Returns the value of attribute mhv_prescriptions

Returns:

  • (Object)

    the current value of mhv_prescriptions



3
4
5
# File 'app/policies/mhv_prescriptions_policy.rb', line 3

def mhv_prescriptions
  @mhv_prescriptions
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of 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.

Returns:

  • (Boolean)


8
9
10
11
12
# File 'app/policies/mhv_prescriptions_policy.rb', line 8

def access?
  service_name = user.identity.[:service_name]
  RX_ACCOUNT_TYPES.include?(user.) &&
    (user.va_patient? || service_name == SignIn::Constants::Auth::MHV)
end