Class: Users::Services

Inherits:
Object
  • Object
show all
Defined in:
app/services/users/services.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ Services

Returns a new instance of Services.



9
10
11
12
# File 'app/services/users/services.rb', line 9

def initialize(user)
  @user = user
  @list = auth_free_services
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



7
8
9
# File 'app/services/users/services.rb', line 7

def user
  @user
end

Instance Method Details

#authorizationsArray<String>

Checks if the initialized user has authorization to access any of the below services. Returns an array of services they have access to.

Returns:

  • (Array<String>)

    Array of names of services they have access to



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/services/users/services.rb', line 19

def authorizations
  @list << BackendServices::RX if user.authorize :mhv_prescriptions, :access?
  @list << BackendServices::MESSAGING if user.authorize :mhv_messaging, :access?
  @list << BackendServices::HEALTH_RECORDS if user.authorize :mhv_health_records, :access?
  @list << BackendServices::EVSS_CLAIMS if user.authorize :evss, :access?
  @list << BackendServices::LIGHTHOUSE if user.authorize :lighthouse, :access?
  @list << BackendServices::FORM526 if user.authorize :evss, :access_form526?
  @list << BackendServices::ADD_PERSON_PROXY if user.authorize :mpi, :access_add_person_proxy?
  @list << BackendServices::USER_PROFILE if user.can_access_user_profile?
  @list << BackendServices::APPEALS_STATUS if user.authorize :appeals, :access?
  @list << BackendServices::ID_CARD if user.can_access_id_card?
  @list << BackendServices::IDENTITY_PROOFED if user.loa3?
  @list << BackendServices::VET360 if user.can_access_vet360?
  @list
end