-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile: Add guard against users that cannot access preferred name and gender identity #12786
Mobile: Add guard against users that cannot access preferred name and gender identity #12786
Conversation
Generated by 🚫 Danger |
Just a note, I had to duplicate a spec so that it's included in both our module and the global directory. If I only included it in the global directory, it would have required moving all of the other cassettes in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should combine these two pundit policies into one, since they do the same thing. I think the hard part is finding a decent name. idme_or_logingov_policy
isn't graceful, but it's accurate. Any better ideas?
Agreed, though my hesitation was if at any point the rules for the policies end up changing. If combining them is the right choice, Demographics could work. It's all handled in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent job on the policy name. Couple questions:
- what's the deal with the generate static docs script being in this PR? I'm guessing maybe it was a git mistake.
- i know you had issues with the spec users and i see that you're still having stub the logingov id. What was the issue?
@@ -0,0 +1,11 @@ | |||
# frozen_string_literal: true | |||
|
|||
DemographicsPolicy = Struct.new(:user, :gender_identity) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a much better name.
allow_any_instance_of(VAProfile::Demographics::Service).to receive(:identifier_present?).and_return(true) | ||
end | ||
before do | ||
iam_sign_in(FactoryBot.build(:iam_user, :logingov)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some of the tests below, you also set the idme_id to nil for these logingov users. Is there a reason that we're not doing the stubs on the instance anyhow, like:
let(:user) { FactoryBot.build(:iam_user, :logingov) }
allow(user).to receive(:logingov_uuid).and_return('b2fab2b5-6af0-45e1-a9e2-394347af91ef')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya that's a fair point, I'll swap it to stub the instance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't think that's possible. The instance created in the controller is different from the instance created in the spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. It's unfortunate that the factory logingov and idme users don't just work for this out of the box. Not worth messing around with though.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
allow_any_instance_of(VAProfile::Demographics::Service).to receive(:identifier_present?).and_return(true) | ||
end | ||
before do | ||
iam_sign_in(FactoryBot.build(:iam_user, :logingov)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. It's unfortunate that the factory logingov and idme users don't just work for this out of the box. Not worth messing around with though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all of the extra reviews! Makes our job easier! 🚀
Summary
We recently found out that only login.gov and id.me users are able to update their preferred name and gender identity. This pr is intended to put policies in place to account for this new knowledge
Related issue(s)
Testing done
Updated tests to account for different uuids being present
Screenshots
Note: Optional
What areas of the site does it impact?
Preferred name and gender identity
Acceptance criteria
Requested Feedback