phi_attrs 0.4.0 → 0.4.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: 237044ea15d9e2cfbabb11218d60dbc32869ab91caa8c5f6f42f13eb2d9c34ff
4
- data.tar.gz: 21b7e8149c94f9bc515767078bcf644976ebcda4e7c14209daec970b24ae8691
3
+ metadata.gz: 28560c0910d408f722f837687ac660a43aa3e708c10366603490270a9bfa3aaf
4
+ data.tar.gz: 9c58fa96bbff3aecf4d7f63defd5bbdba40e72ddea6073dc3f02337b4b9a4b36
5
5
  SHA512:
6
- metadata.gz: 9cbaf5dcb370bd661ccbef997adbd68828289c9c7aa56e66c4773e765dffd2d65d41248991f3543b42fc09a73416fd9d8e38a9a3ce174fb1e95ddc89d268499c
7
- data.tar.gz: e2c6245f0ef7843b4b55d3d0f2b4acf850ccfcc72755dc6482f09cb08e19efa8f0afdf2c5b26b56f1ee0bc5f7cec4128401764c54bb79905d767c93c05f9faaf
6
+ metadata.gz: 639da1bdf5990baacfd20d427690c2ff7fb4445461ab150aafea3f2b9e611074fc1e6dd3a32198e50de18a5002095e818c38a3deec50c3ac3f75560ad3fe831f
7
+ data.tar.gz: 0b1efe76204b467c5ea51c48d5df7153e7cf63df3fa89530e2d331d8f9e9b5813673f0feb01443d90ea67bae87eee47ff267e7b319588588f619782e087858ac
data/README.md CHANGED
@@ -471,34 +471,18 @@ Run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run lin
471
471
 
472
472
  To install this gem onto your local machine, run `bundle exec rake install`.
473
473
 
474
- ### Releases
475
-
476
- Releases are driven by git tags. The version lives in `lib/phi_attrs/version.rb`, and the gemspec reads `PhiAttrs::VERSION`.
477
-
478
- ```bash
479
- bundle install
480
- bin/release patch # or: minor, major
481
- ```
482
-
483
- To publish an RC for a specific version:
484
-
485
- ```bash
486
- bin/release rc 1.2.0
487
- ```
488
-
489
- This sets the version to `1.2.0-rc` and tags it as `v1.2.0-rc`.
474
+ ### Releasing
490
475
 
491
- Prereleases can also use `bump`'s native `pre` increment:
476
+ Create a release from `main`:
492
477
 
493
- ```bash
494
- bin/release pre
478
+ ```sh
479
+ bin/release {major|minor|patch|pre}
480
+ git push --follow-tags
495
481
  ```
496
482
 
497
- `pre` cycles prerelease labels in order: `alpha`, `beta`, `rc`, then the final version. For example, `1.2.0-rc` becomes `1.2.0`, tagged as `v1.2.0`.
498
-
499
- `bin/release` uses `bump`, commits the version file, creates a `v<version>` tag, pushes the branch, and pushes the tag.
483
+ The release script validates the repository, bumps the version, creates a git tag.
500
484
 
501
- GitHub Actions publishes only when a `v*` tag is pushed. The publish workflow builds the gem, pushes it to RubyGems with `RUBYGEMS_API_KEY`, and creates a GitHub release with the built gem attached. Tags containing a prerelease suffix, such as `v1.2.0-rc`, are marked as prereleases on GitHub.
485
+ Publishing to RubyGems and creating a GitHub Release are handled automatically by GitHub Actions.
502
486
 
503
487
 
504
488
  ## Contributing
@@ -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
- if phi_allowed? && relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)
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
- r.allow_phi!(phi_allowed_by, phi_access_reason) unless @__phi_relations_extended.include?(r)
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhiAttrs
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phi_attrs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wyatt Kirby