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
V7_POSSIBLE_RESOURCES =
(V6_POSSIBLE_RESOURCES + ['Location']).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_2, G10Options::SMART_2_2_REQUIREMENT, 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_7, G10Options::US_CORE_7_REQUIREMENT, G10Options::US_CORE_VERSION_NUMBERS

Instance Method Summary collapse

Methods included from G10Options

#us_core_7_and_above?, #us_core_version, #using_us_core_3?, #using_us_core_4?, #using_us_core_5?, #using_us_core_6?, #using_us_core_7?, #versioned_us_core_module

Instance Method Details

#possible_resourcesObject



42
43
44
45
46
47
48
49
50
# File 'lib/onc_certification_g10_test_kit/limited_scope_grant_test.rb', line 42

def possible_resources
  return V5_POSSIBLE_RESOURCES if using_us_core_5?

  return V6_POSSIBLE_RESOURCES if using_us_core_6?

  return V7_POSSIBLE_RESOURCES if using_us_core_7?

  POSSIBLE_RESOURCES
end

#scope_granting_access?(resource_type, scopes) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
55
56
57
58
59
60
61
# File 'lib/onc_certification_g10_test_kit/limited_scope_grant_test.rb', line 52

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