When dealing with a phi_model it's not that infrequent that we'll have joinedphi_models. For convenience, we should have a shorthand method of extending allow_phi! to include those joins.
There should be two methods of doing this. One at the class level, which essentially acts as a permanent extension: allowing PHI access on this model will grant PHI access on these models. I'm thinking a syntax like:
class PatientInfo < ActiveRecord::Base
phi_model
end
class Patient < ActiveRecord::Base
has_one :patient_info
phi_model
extend_phi_access :patient_info
end
patient = Patient.new
patient.allow_phi!('user@example.com', 'reason')
patient.patient_info.first_name
Additionally, there should be a per-usage shorthand. Something that is passed as an argument to allow_phi!. I'm thinking something like:
class PatientInfo < ActiveRecord::Base
phi_model
end
class Patient < ActiveRecord::Base
has_one :patient_info
phi_model
end
patient = Patient.new
patient.allow_phi!('user@example.com', 'reason', include: [:patient_info])
patient.patient_info.first_name
When dealing with a
phi_model
it's not that infrequent that we'll have joinedphi_models
. For convenience, we should have a shorthand method of extendingallow_phi!
to include those joins.There should be two methods of doing this. One at the class level, which essentially acts as a permanent extension: allowing PHI access on this model will grant PHI access on these models. I'm thinking a syntax like:
Additionally, there should be a per-usage shorthand. Something that is passed as an argument to
allow_phi!
. I'm thinking something like: