class CIS2Info
Constants
- ACCESS_SENSITIVE_FLAGGED_RECORDS_ACTIVITY_CODE
- INDEPENDENT_PRESCRIBING_ACTIVITY_CODE
- LOCAL_SYSTEM_ADMINISTRATION_ACTIVITY_CODE
- MEDICAL_SECRETARY_ROLES
- NURSE_ROLES
- PERSONAL_MEDICATION_ADMINISTRATION_ACTIVITY_CODE
- SUPPORT_ROLE
- SUPPORT_WORKGROUP
- VIEW_DETAILED_HEALTH_RECORDS_ACTIVITY_CODE
- VIEW_SHARED_NON_PATIENT_IDENTIFIABLE_INFORMATION_ACTIVITY_CODE
Public Class Methods
Source
# File app/models/cis2_info.rb, line 12 def self.support_organisation Settings.cis2.support_organisation end
Public Instance Methods
Source
# File app/models/cis2_info.rb, line 73 def can_access_sensitive_flagged_records? activity_codes.include?(ACCESS_SENSITIVE_FLAGGED_RECORDS_ACTIVITY_CODE) end
Source
# File app/models/cis2_info.rb, line 77 def can_perform_local_system_administration? activity_codes.include?(LOCAL_SYSTEM_ADMINISTRATION_ACTIVITY_CODE) end
Source
# File app/models/cis2_info.rb, line 81 def can_view_detailed_health_records? activity_codes.include?(VIEW_DETAILED_HEALTH_RECORDS_ACTIVITY_CODE) end
Source
# File app/models/cis2_info.rb, line 48 def has_valid_workgroup? = organisation&.teams&.exists?(workgroup: workgroups) || false def is_medical_secretary? MEDICAL_SECRETARY_ROLES.include?(role_code) end def is_nurse? NURSE_ROLES.include?(role_code) end def is_healthcare_assistant? MEDICAL_SECRETARY_ROLES.include?(role_code) && activity_codes.include?(PERSONAL_MEDICATION_ADMINISTRATION_ACTIVITY_CODE) end def is_prescriber? activity_codes.include?(INDEPENDENT_PRESCRIBING_ACTIVITY_CODE) end def is_superuser? can_access_sensitive_flagged_records? || can_perform_local_system_administration? end def can_access_sensitive_flagged_records? activity_codes.include?(ACCESS_SENSITIVE_FLAGGED_RECORDS_ACTIVITY_CODE) end def can_perform_local_system_administration? activity_codes.include?(LOCAL_SYSTEM_ADMINISTRATION_ACTIVITY_CODE) end def can_view_detailed_health_records? activity_codes.include?(VIEW_DETAILED_HEALTH_RECORDS_ACTIVITY_CODE) end def can_view_shared_non_patient_identifiable_information? activity_codes.include?( VIEW_SHARED_NON_PATIENT_IDENTIFIABLE_INFORMATION_ACTIVITY_CODE ) end def is_support? is_support_without_pii_access? || is_support_with_pii_access? end def is_support_without_pii_access? role_code == SUPPORT_ROLE && can_view_shared_non_patient_identifiable_information? end def is_support_with_pii_access? role_code == SUPPORT_ROLE && can_view_detailed_health_records? end private def request_session_key = "cis2_info"
Source
# File app/models/cis2_info.rb, line 59 def is_healthcare_assistant? MEDICAL_SECRETARY_ROLES.include?(role_code) && activity_codes.include?(PERSONAL_MEDICATION_ADMINISTRATION_ACTIVITY_CODE) end
Source
# File app/models/cis2_info.rb, line 51 def is_medical_secretary? MEDICAL_SECRETARY_ROLES.include?(role_code) end
Source
# File app/models/cis2_info.rb, line 55 def is_nurse? NURSE_ROLES.include?(role_code) end
Source
# File app/models/cis2_info.rb, line 64 def is_prescriber? activity_codes.include?(INDEPENDENT_PRESCRIBING_ACTIVITY_CODE) end
Source
# File app/models/cis2_info.rb, line 68 def is_superuser? can_access_sensitive_flagged_records? || can_perform_local_system_administration? end
Source
# File app/models/cis2_info.rb, line 91 def is_support? is_support_without_pii_access? || is_support_with_pii_access? end
Source
# File app/models/cis2_info.rb, line 100 def is_support_with_pii_access? role_code == SUPPORT_ROLE && can_view_detailed_health_records? end
Source
# File app/models/cis2_info.rb, line 95 def is_support_without_pii_access? role_code == SUPPORT_ROLE && can_view_shared_non_patient_identifiable_information? end
Source
# File app/models/cis2_info.rb, line 34 def organisation @organisation ||= if (ods_code = organisation_code).present? Organisation.find_by(ods_code:) end end
Source
# File app/models/cis2_info.rb, line 32 def present? = attributes.compact_blank.present? def organisation @organisation ||= if (ods_code = organisation_code).present? Organisation.find_by(ods_code:) end end def team @team ||= if (workgroup = team_workgroup).present? && workgroups.include?(workgroup) Team.find_by(organisation:, workgroup:) end end def has_valid_workgroup? = organisation&.teams&.exists?(workgroup: workgroups) || false def is_medical_secretary? MEDICAL_SECRETARY_ROLES.include?(role_code) end def is_nurse? NURSE_ROLES.include?(role_code) end def is_healthcare_assistant? MEDICAL_SECRETARY_ROLES.include?(role_code) && activity_codes.include?(PERSONAL_MEDICATION_ADMINISTRATION_ACTIVITY_CODE) end def is_prescriber? activity_codes.include?(INDEPENDENT_PRESCRIBING_ACTIVITY_CODE) end def is_superuser? can_access_sensitive_flagged_records? || can_perform_local_system_administration? end def can_access_sensitive_flagged_records? activity_codes.include?(ACCESS_SENSITIVE_FLAGGED_RECORDS_ACTIVITY_CODE) end def can_perform_local_system_administration? activity_codes.include?(LOCAL_SYSTEM_ADMINISTRATION_ACTIVITY_CODE) end def can_view_detailed_health_records? activity_codes.include?(VIEW_DETAILED_HEALTH_RECORDS_ACTIVITY_CODE) end def can_view_shared_non_patient_identifiable_information? activity_codes.include?( VIEW_SHARED_NON_PATIENT_IDENTIFIABLE_INFORMATION_ACTIVITY_CODE ) end def is_support? is_support_without_pii_access? || is_support_with_pii_access? end def is_support_without_pii_access? role_code == SUPPORT_ROLE && can_view_shared_non_patient_identifiable_information? end def is_support_with_pii_access? role_code == SUPPORT_ROLE && can_view_detailed_health_records? end private def request_session_key =
Source
# File app/models/cis2_info.rb, line 106 def request_session_key = "cis2_info" end
Source
# File app/models/cis2_info.rb, line 41 def team @team ||= if (workgroup = team_workgroup).present? && workgroups.include?(workgroup) Team.find_by(organisation:, workgroup:) end end