Class: ONCCertificationG10TestKit::LimitedScopeGrantTest

Inherits:
Inferno::Test
  • Object
show all
Includes:
G10Options
Defined in:
lib/onc_certification_g10_test_kit/limited_scope_grant_test.rb

Constant Summary collapse

POSSIBLE_RESOURCES =
[
  'AllergyIntolerance',
  'CarePlan',
  'CareTeam',
  'Condition',
  'Device',
  'DiagnosticReport',
  'DocumentReference',
  'Goal',
  'Immunization',
  'MedicationRequest',
  'Observation',
  'Procedure',
  'Patient'
].freeze
V5_POSSIBLE_RESOURCES =
(POSSIBLE_RESOURCES + ['Encounter', 'ServiceRequest']).freeze
V6_POSSIBLE_RESOURCES =
(V5_POSSIBLE_RESOURCES + ['Specimen', 'Coverage', 'MedicationDispense']).freeze

Constants included from G10Options

G10Options::BULK_DATA_1, G10Options::BULK_DATA_1_REQUIREMENT, G10Options::BULK_DATA_2, G10Options::BULK_DATA_2_REQUIREMENT, G10Options::SMART_1, G10Options::SMART_1_REQUIREMENT, G10Options::SMART_2, G10Options::SMART_2_REQUIREMENT, G10Options::US_CORE_3, G10Options::US_CORE_3_REQUIREMENT, G10Options::US_CORE_4, G10Options::US_CORE_4_REQUIREMENT, G10Options::US_CORE_5, G10Options::US_CORE_5_REQUIREMENT, G10Options::US_CORE_6, G10Options::US_CORE_6_REQUIREMENT, G10Options::US_CORE_VERSION_NUMBERS

Instance Method Summary collapse

Methods included from G10Options

#us_core_version, #using_us_core_3?, #using_us_core_5?, #using_us_core_6?, #versioned_us_core_module

Instance Method Details

#possible_resourcesObject



40
41
42
43
44
45
46
# File 'lib/onc_certification_g10_test_kit/limited_scope_grant_test.rb', line 40

def possible_resources
  return V5_POSSIBLE_RESOURCES if using_us_core_5?

  return V6_POSSIBLE_RESOURCES if using_us_core_6?

  POSSIBLE_RESOURCES
end

#scope_granting_access?(resource_type, scopes) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
52
53
54
55
56
57
# File 'lib/onc_certification_g10_test_kit/limited_scope_grant_test.rb', line 48

def scope_granting_access?(resource_type, scopes)
  scopes
    .select { |scope| scope.start_with?("patient/#{resource_type}", 'patient/*') }
    .any? do |scope|
      _type, resource_access = scope.split('/')
      _resource, access_level = resource_access.split('.')

      access_level.match?(/\A(\*|read|c?ru?d?s?\b)/)
    end
end