phi_attrs 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/phi_attrs/phi_record.rb +30 -30
- data/lib/phi_attrs/version.rb +1 -1
- metadata +6 -7
- data/CHANGELOG.md +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb209a550589eee5edbb17853c56c001c9ce8f7292784e1775cebb644468b830
|
4
|
+
data.tar.gz: 0ca474072ecf6b33b2491ac77f097622e4611716d8c95fb03afee896615b8ac8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19021f005a8283d3db4da049c8278dd63b4e0cf5b229ddec2274b414501c9414347e8553d47bfdf5597d06f3da3d4ae2c679fe852d98c8a94e5299f7cb598f1e
|
7
|
+
data.tar.gz: 8fdf599c5db471f842ee25fb91e50d5e54d3c9174978e709ebab5c6d45219a7bc8025f3b7060a51d425bc5fcd1176bcd7ea04df0054b50e8fb48b83c41658170
|
data/README.md
CHANGED
@@ -463,7 +463,7 @@ To release a new version, update the version number in `version.rb`, and then ru
|
|
463
463
|
|
464
464
|
Bug reports and pull requests are welcome on GitHub at https://github.com/apsislabs/phi_attrs.
|
465
465
|
|
466
|
-
Any PRs should be accompanied with documentation in `README.md
|
466
|
+
Any PRs should be accompanied with documentation in `README.md`.
|
467
467
|
|
468
468
|
## License
|
469
469
|
|
data/lib/phi_attrs/phi_record.rb
CHANGED
@@ -142,32 +142,32 @@ module PhiAttrs
|
|
142
142
|
# Save this so we don't revoke access previously extended outside the block
|
143
143
|
frozen_instances = __instances_with_extended_phi.index_with { |obj| obj.instance_variable_get(:@__phi_relations_extended).clone }
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
145
|
+
begin
|
146
|
+
if allow_only.nil?
|
147
|
+
allow_phi!(user_id, reason)
|
148
|
+
else
|
149
|
+
allow_only.each { |t| t.allow_phi!(user_id, reason) }
|
150
|
+
end
|
150
151
|
|
151
|
-
|
152
|
+
return yield
|
153
|
+
ensure
|
154
|
+
__instances_with_extended_phi.each do |obj|
|
155
|
+
if frozen_instances.include?(obj)
|
156
|
+
old_extensions = frozen_instances[obj]
|
157
|
+
new_extensions = obj.instance_variable_get(:@__phi_relations_extended) - old_extensions
|
158
|
+
obj.send(:revoke_extended_phi!, new_extensions) if new_extensions.any?
|
159
|
+
else
|
160
|
+
obj.send(:revoke_extended_phi!) # Instance is new to the set, so revoke everything
|
161
|
+
end
|
162
|
+
end
|
152
163
|
|
153
|
-
|
154
|
-
|
155
|
-
old_extensions = frozen_instances[obj]
|
156
|
-
new_extensions = obj.instance_variable_get(:@__phi_relations_extended) - old_extensions
|
157
|
-
obj.send(:revoke_extended_phi!, new_extensions) if new_extensions.any?
|
164
|
+
if allow_only.nil?
|
165
|
+
disallow_last_phi!
|
158
166
|
else
|
159
|
-
|
167
|
+
allow_only.each { |t| t.disallow_last_phi!(preserve_extensions: true) }
|
168
|
+
# We've handled any newly extended allowances ourselves above
|
160
169
|
end
|
161
170
|
end
|
162
|
-
|
163
|
-
if allow_only.nil?
|
164
|
-
disallow_last_phi!
|
165
|
-
else
|
166
|
-
allow_only.each { |t| t.disallow_last_phi!(preserve_extensions: true) }
|
167
|
-
# We've handled any newly extended allowances ourselves above
|
168
|
-
end
|
169
|
-
|
170
|
-
result
|
171
171
|
end
|
172
172
|
|
173
173
|
# Explicitly disallow phi access in a specific area of code. This does not
|
@@ -385,15 +385,15 @@ module PhiAttrs
|
|
385
385
|
raise ArgumentError, 'block required' unless block_given?
|
386
386
|
|
387
387
|
extended_instances = @__phi_relations_extended.clone
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
388
|
+
begin
|
389
|
+
allow_phi!(user_id, reason)
|
390
|
+
|
391
|
+
return yield
|
392
|
+
ensure
|
393
|
+
new_extensions = @__phi_relations_extended - extended_instances
|
394
|
+
disallow_last_phi!(preserve_extensions: true)
|
395
|
+
revoke_extended_phi!(new_extensions) if new_extensions.any?
|
396
|
+
end
|
397
397
|
end
|
398
398
|
|
399
399
|
# Revoke all PHI access for a single instance of this class.
|
data/lib/phi_attrs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phi_attrs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wyatt Kirby
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -178,14 +178,13 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
-
description:
|
181
|
+
description:
|
182
182
|
email:
|
183
183
|
- wyatt@apsis.io
|
184
184
|
executables: []
|
185
185
|
extensions: []
|
186
186
|
extra_rdoc_files: []
|
187
187
|
files:
|
188
|
-
- CHANGELOG.md
|
189
188
|
- DISCLAIMER.txt
|
190
189
|
- LICENSE.txt
|
191
190
|
- README.md
|
@@ -221,8 +220,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
220
|
- !ruby/object:Gem::Version
|
222
221
|
version: '0'
|
223
222
|
requirements: []
|
224
|
-
rubygems_version: 3.3.
|
225
|
-
signing_key:
|
223
|
+
rubygems_version: 3.3.27
|
224
|
+
signing_key:
|
226
225
|
specification_version: 4
|
227
226
|
summary: PHI Access Restriction & Logging for Rails ActiveRecord
|
228
227
|
test_files: []
|
data/CHANGELOG.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Changelog
|
2
|
-
All notable changes to this project will be documented in this file.
|
3
|
-
|
4
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
-
|
7
|
-
## [Unreleased]
|
8
|
-
### Added
|
9
|
-
- Added documentation for CHANGELOG to README
|
10
|
-
|
11
|
-
## [v0.1.4] - 2018-07-05
|
12
|
-
## [v0.1.3] - 2018-07-05
|
13
|
-
## [v0.1.2] - 2018-07-05
|
14
|
-
## [v0.1.1] - 2018-07-05
|
15
|
-
|
16
|
-
## [v0.1.0] - 2018-07-04
|
17
|
-
Initial release
|