Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add update user password endpoint#1310

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 17 commits intomainfrombq/update-user-password
May 6, 2022

Conversation

BrunoQuaresma
Copy link
Collaborator

Closes#1309

@BrunoQuaresmaBrunoQuaresma requested a review froma teamMay 5, 2022 14:03
@BrunoQuaresmaBrunoQuaresma self-assigned thisMay 5, 2022
@BrunoQuaresma
Copy link
CollaboratorAuthor

I realized/remember the UI should be able to update the password for other users as well so I think we should skip the password verification when the user is admin and if it is trying to change another user's password. Or, to make it simple for BETA, I can just remove this verification or comment the block. Thoughts?

f0ssel reacted with thumbs up emoji

@codecov
Copy link

codecovbot commentedMay 5, 2022
edited
Loading

Codecov Report

Merging#1310 (671c56d) intomain (0ccf010) willincrease coverage by0.07%.
The diff coverage is60.86%.

@@            Coverage Diff             @@##             main    #1310      +/-   ##==========================================+ Coverage   66.10%   66.18%   +0.07%==========================================  Files         281      281                Lines       18424    18479      +55       Branches      220      220              ==========================================+ Hits        12180    12230      +50- Misses       4982     4984       +2- Partials     1262     1265       +3
FlagCoverage Δ
unittest-go-macos-latest53.61% <54.34%> (+0.05%)⬆️
unittest-go-postgres-64.97% <60.86%> (+0.09%)⬆️
unittest-go-ubuntu-latest56.08% <54.34%> (+0.20%)⬆️
unittest-go-windows-202252.04% <54.34%> (+0.16%)⬆️
unittest-js71.61% <ø> (ø)
Impacted FilesCoverage Δ
coderd/httpmw/userparam.go83.67% <ø> (-2.05%)⬇️
coderd/rbac/object.go100.00% <ø> (ø)
coderd/users.go61.36% <42.30%> (+0.15%)⬆️
codersdk/users.go65.17% <70.00%> (+0.22%)⬆️
coderd/coderd.go94.53% <100.00%> (+0.08%)⬆️
coderd/coderdtest/coderdtest.go98.86% <100.00%> (-0.02%)⬇️
coderd/database/queries.sql.go78.14% <100.00%> (+0.03%)⬆️
codersdk/provisionerdaemons.go61.97% <0.00%> (-5.64%)⬇️
cli/cliui/agent.go77.46% <0.00%> (-5.00%)⬇️
provisionerd/provisionerd.go76.17% <0.00%> (-0.94%)⬇️
... and9 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update0ccf010...671c56d. Read thecomment docs.

@BrunoQuaresmaBrunoQuaresma requested a review fromf0sselMay 5, 2022 14:27
Copy link
Contributor

@f0sself0ssel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Do we not have an RBAC gate for admins yet? Kinda worried about shipping this and allow any user to reset any other user's password.

presleyp reacted with thumbs up emoji
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just a few nits, other than that I think the PR looks good. 👍🏻

@BrunoQuaresma
Copy link
CollaboratorAuthor

@f0ssel RBAC added!

@BrunoQuaresmaBrunoQuaresma requested a review froma team as acode ownerMay 5, 2022 17:17
Copy link
Contributor

@presleyppresleyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The frontend bit looks good to me!

BrunoQuaresma reacted with hooray emoji
Copy link
Contributor

@f0sself0ssel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Small suggestions but it looks good 👍

BrunoQuaresma reacted with hooray emoji
@@ -287,6 +287,41 @@ func TestUpdateUserProfile(t *testing.T) {
})
}

func TestUpdateUserPassword(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Let's also add some tests to make sure the rbac is working here, I'd like to ensure that the user itself cannot perform this action, and neither can other non-admin users.

Copy link
CollaboratorAuthor

@BrunoQuaresmaBrunoQuaresmaMay 5, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

So from what I'm understanding we want to test:

  • A non-admin user can't update any password
  • An admin can update another user's password

Is that?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Updated!

BrunoQuaresmaand others added2 commitsMay 5, 2022 14:57
Co-authored-by: Garrett Delfosse <garrett@coder.com>
@@ -76,14 +76,6 @@ func ExtractUserParam(db database.Store) func(http.Handler) http.Handler {
}
}

apiKey := APIKey(r)
if apiKey.UserID != user.ID {
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I removed this because it was "overriding" RBAC roles. I know we don’t have the RBAC in place for all the user routes, but I can try to do that next. Probably I can send a PR on Monday. Thoughts? cc.:@f0ssel

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@BrunoQuaresmaBrunoQuaresma merged commit57bb108 intomainMay 6, 2022
@BrunoQuaresmaBrunoQuaresma deleted the bq/update-user-password branchMay 6, 2022 14:20
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
kylecarbs pushed a commit that referenced this pull requestJun 10, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@coadlercoadlercoadler left review comments

@presleyppresleyppresleyp approved these changes

@f0sself0sself0ssel approved these changes

@mafredrimafredriAwaiting requested review from mafredri

Assignees

@BrunoQuaresmaBrunoQuaresma

Labels
None yet
Projects
None yet
Milestone
V2 Beta
Development

Successfully merging this pull request may close these issues.

Add update user password endpoint
6 participants
@BrunoQuaresma@mafredri@presleyp@coadler@f0ssel@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp