Class: MPIPolicy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mviObject

Returns the value of attribute mvi

Returns:

  • (Object)

    the current value of mvi



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

def mvi
  @mvi
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



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

def user
  @user
end

Instance Method Details

#access_add_person_proxy?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'app/policies/mpi_policy.rb', line 4

def access_add_person_proxy?
  user.edipi.present? && user.ssn.present? && (user.birls_id.blank? || user.participant_id.blank?)
end

#queryable?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/policies/mpi_policy.rb', line 8

def queryable?
  user.icn.present? || required_attrs_present?(user)
end

#required_attrs_present?(user) ⇒ Boolean (private)

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
# File 'app/policies/mpi_policy.rb', line 14

def required_attrs_present?(user)
  return false if user.first_name.blank?
  return false if user.last_name.blank?
  return false if user.birth_date.blank?
  return false if user.ssn.blank?
  return false if user.gender.blank?

  true
end