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: Prevent role changing on yourself.#1931

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
Emyrk merged 3 commits intomainfromstevenmasley/admin_demote
May 31, 2022
Merged

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedMay 31, 2022
edited
Loading

Only allow changing roles on other users. Not much value in self changing
at the moment

#1847

Future Work

Update UI error

Screenshot from 2022-05-31 15-15-55

Response payload

{"message":"You cannot change your own roles."}

Only allow changing roles on other users. Not much value in self changingat the moment
@EmyrkEmyrk requested a review fromf0sselMay 31, 2022 20:16
@@ -445,7 +445,7 @@ func TestGrantRoles(t *testing.T) {
require.Error(t, err, "member cannot change other's roles")
requireStatusCode(t, err, http.StatusForbidden)

_, err = member.UpdateUserRoles(ctx,memberUser.ID.String(), codersdk.UpdateRoles{
_, err = member.UpdateUserRoles(ctx,first.UserID.String(), codersdk.UpdateRoles{
Roles: []string{rbac.RoleMember()},
})
require.Error(t, err, "member cannot change any roles")
Copy link
Contributor

Choose a reason for hiding this comment

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

This should reference "changing their own role" in the error or test name.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I added those tests 👍

@EmyrkEmyrk merged commit7acb742 intomainMay 31, 2022
@EmyrkEmyrk deleted the stevenmasley/admin_demote branchMay 31, 2022 20:50
kylecarbs pushed a commit that referenced this pull requestJun 10, 2022
* feat: Prevent role changing on yourself.Only allow changing roles on other users. Not much value in self changingat the moment
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kylecarbskylecarbskylecarbs approved these changes

@f0sself0sself0ssel approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Emyrk@kylecarbs@f0ssel

[8]ページ先頭

©2009-2025 Movatter.jp