-
-
Notifications
You must be signed in to change notification settings - Fork 529
#1785 - admins can add/edit phone numbers for all users #3375
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
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
d3176fa
add rspec tests for model validations
xihai01 e22169f
modify rspec model validation test to check for 12 digit phone number…
xihai01 a66f98e
model phone number field for users table in db
xihai01 6867630
refactor volunteer_controller specs
xihai01 f68c099
create request rspec test for volunteer update as admin
xihai01 56cf925
create request rspec test for supervisor update as admin
xihai01 95dbd57
create request rspec test for admin update as admin
xihai01 6bcbcd2
add integration tests for form fields with phone number
xihai01 2b22a20
add phone number input to views
xihai01 c3f9871
refactor user_validator to spit out clearer errors for phone number
xihai01 69ad254
add locales for en.common.phone_number
xihai01 d193df4
update error message for invalid phone number
xihai01 e964f01
fix tests
xihai01 68468bb
include phone number as a param for casa admin controller
xihai01 e7110cb
create system spec for users to check for invalid phone number form e…
xihai01 9bd38ae
lint files
xihai01 b372f86
remove duplicate test and used fake phone numbers for tests
xihai01 2692b68
refactor system specs to use shared_examples
xihai01 cc08751
refactor system spec for users to use shared_examples
xihai01 170d10e
create partial for the user form inputs to avoid duplication in views
xihai01 d375fb2
create a policy for previous partial
xihai01 7e6c6da
lint files
xihai01 3e795c3
delete duplicate migration for phone number column
xihai01 47c7789
Revert "delete duplicate migration for phone number column"
xihai01 b1218af
delete duplicate migration
xihai01 d434741
Merge branch 'main' into f/1785
xihai01 174d360
Merge pull request #1 from xihai01/f/1785
xihai01 77b7030
feature 1785 ready to PR
xihai01 d10a2a4
fix import spec with new error msgs
xihai01 870c8f8
fix policy permissions and correct some people's names
xihai01 a6a9245
remove admin has to be from same org for policy permissions
xihai01 4a0aeef
update db schema
xihai01 b4709d9
create view spec for supervisors/edit to check for editable/disabled …
xihai01 1d6b675
edit supervisors/edit view with permissions for phone number field
xihai01 dec5145
Merge pull request #2 from xihai01/f/1786
xihai01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,14 @@ def update_supervisor_name? | |
| update_supervisor_email? | ||
| end | ||
|
|
||
| def update_user_setting? | ||
| if is_supervisor_same_org? | ||
| # allow access to own record or volunteer record | ||
| return record == user || record.volunteer? | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. permissions issue- must make sure that the volunteer belongs to the correct casa org
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| end | ||
| is_admin? | ||
| end | ||
|
|
||
| def edit_name?(viewed_user) | ||
| is_admin? || viewed_user == user | ||
| end | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <div class="field form-group"> | ||
| <%= f.label :email, t("common.email") %> | ||
| <% if policy(resource).update_user_setting? %> | ||
| <%= f.text_field :email, class: "form-control" %> | ||
| <% else %> | ||
| <input class="form-control" type="text" placeholder="<%= resource.email %>" autocomplete="off" readonly> | ||
| <% end %> | ||
| </div> | ||
|
|
||
| <div class="field form-group"> | ||
| <%= f.label :display_name, t("common.display_name") %> | ||
| <% if policy(resource).update_user_setting? %> | ||
| <%= f.text_field :display_name, class: "form-control" %> | ||
| <% else %> | ||
| <input class="form-control" type="text" placeholder="<%= resource.display_name %>" autocomplete="off" readonly> | ||
| <% end %> | ||
| </div> | ||
|
|
||
| <div class="field form-group"> | ||
| <%= f.label :phone_number, t("common.phone_number") %> | ||
| <% if policy(resource).update_user_setting? %> | ||
| <%= f.text_field :phone_number, class: "form-control" %> | ||
| <% else %> | ||
| <input class="form-control" type="text" placeholder="<%= resource.phone_number %>" autocomplete="off" readonly> | ||
| <% end %> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
if we're using the fancy validator, should we put all the existing validators in it also and remove them here?
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 this would be a great issue to create for