phi_attrs 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/phi_attrs/phi_record.rb +7 -4
- data/lib/phi_attrs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '05083f79f5cdcfc67ab415d129d37d84f287612a1669cc966d0ec065b60df474'
|
|
4
|
+
data.tar.gz: 89256e8ca7a9f67738a49d119a3b7ce9d3bd364d295f4562fa2cb9a11617553c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: caaaba36bc35c442ac349e6131cec84c5603e7c27a8dd3f28d436a47a39225f016721d3b38a75ed4cb426154afb97a7040de69e3622141e59190056f939d429d
|
|
7
|
+
data.tar.gz: e4be1b87f3129b9abaf7200f300cf3f3e10034f61d476348503798cff8545b82bee455c3c26e76894e12bfbda2d99a2ee17df65e065b7251a71a99f2e2c5c390
|
data/lib/phi_attrs/phi_record.rb
CHANGED
|
@@ -526,7 +526,7 @@ module PhiAttrs
|
|
|
526
526
|
raise PhiAttrs::Exceptions::PhiAccessException, 'PHI Access required, please call allow_phi or allow_phi! first' unless phi_allowed?
|
|
527
527
|
end
|
|
528
528
|
|
|
529
|
-
def reload
|
|
529
|
+
def reload(options = nil)
|
|
530
530
|
@__phi_relations_extended.clear
|
|
531
531
|
super
|
|
532
532
|
end
|
|
@@ -703,12 +703,15 @@ module PhiAttrs
|
|
|
703
703
|
self.class.send(:define_method, wrapped_method) do |*args, **kwargs, &block|
|
|
704
704
|
relation = send(unwrapped_method, *args, **kwargs, &block)
|
|
705
705
|
|
|
706
|
-
|
|
706
|
+
access_context = phi_context
|
|
707
|
+
if access_context&.phi_access_allowed && relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)
|
|
707
708
|
relations = relation.is_a?(Enumerable) ? relation : [relation]
|
|
708
709
|
relations.each do |r|
|
|
709
|
-
|
|
710
|
+
next if @__phi_relations_extended.include?(r) && r.phi_allowed?
|
|
711
|
+
|
|
712
|
+
r.allow_phi!(access_context.user_id, access_context.reason)
|
|
713
|
+
@__phi_relations_extended.add(r)
|
|
710
714
|
end
|
|
711
|
-
@__phi_relations_extended.merge(relations)
|
|
712
715
|
self.class.__instances_with_extended_phi.add(self)
|
|
713
716
|
end
|
|
714
717
|
|
data/lib/phi_attrs/version.rb
CHANGED