phi_attrs 0.3.1 → 0.3.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a9f9b3520ac31b3070fe055edc824ff9e5fb57ac7ae3a2aa1e21fbca0cbe938
4
- data.tar.gz: c6e59941ca3647104021f42f15c983200f2abec40161873adeeef9188d8f28eb
3
+ metadata.gz: bb209a550589eee5edbb17853c56c001c9ce8f7292784e1775cebb644468b830
4
+ data.tar.gz: 0ca474072ecf6b33b2491ac77f097622e4611716d8c95fb03afee896615b8ac8
5
5
  SHA512:
6
- metadata.gz: 11fc15e014f7a99b47d7bac128ac55497a1be75add80751168a60abe14234e86503c4cca8c88116e6cee66d10675394c2cd1e413e023826b0944778c2647bb68
7
- data.tar.gz: 7bc73305c3a0713bcde53250b9334df225d885a31a15e3837b984b7783bd51974a37a97b92d706e74a93413eaf19b0972c1e998f12b6f1643c6159d46d396035
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`, and changes documented in [`CHANGELOG.md`](https://keepachangelog.com/).
466
+ Any PRs should be accompanied with documentation in `README.md`.
467
467
 
468
468
  ## License
469
469
 
@@ -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
- if allow_only.nil?
146
- allow_phi!(user_id, reason)
147
- else
148
- allow_only.each { |t| t.allow_phi!(user_id, reason) }
149
- end
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
- result = yield if block_given?
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
- __instances_with_extended_phi.each do |obj|
154
- if frozen_instances.include?(obj)
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
- obj.send(:revoke_extended_phi!) # Instance is new to the set, so revoke everything
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
- allow_phi!(user_id, reason)
389
-
390
- result = yield if block_given?
391
-
392
- new_extensions = @__phi_relations_extended - extended_instances
393
- disallow_last_phi!(preserve_extensions: true)
394
- revoke_extended_phi!(new_extensions) if new_extensions.any?
395
-
396
- result
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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhiAttrs
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
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.1
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: 2023-02-27 00:00:00.000000000 Z
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.26
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