Skip to content

feat: Add user roles, but do not yet enforce them #1199

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

Closed
wants to merge 9 commits into from

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Apr 27, 2022

What this does

Adds some builtin roles and assigns them to users and org members. This does not implement enforcing roles at this time.

Granting user's roles was added to test the api. See how to grant roles from the SDK. The "strange" part is that the rbac library is used to find the role name. In practice, there will be an endpoint to list all roles that can be granted, and the user will select from a list. The code for this exists, but I want to add this in future PRs as I work with the FE on endpoint format.

coder/coderd/users_test.go

Lines 326 to 330 in a643670

_, err = member.GrantUserRoles(ctx, codersdk.Me, codersdk.GrantUserRoles{
Roles: []string{
rbac.RoleAdmin(),
rbac.RoleOrgAdmin(first.OrganizationID),
},

Future Work

  • Add ability to remove roles
  • Add proper authorize usage on endpoints
  • List roles that can be granted

@Emyrk Emyrk marked this pull request as ready for review April 27, 2022 20:48
@Emyrk Emyrk requested a review from a team as a code owner April 27, 2022 20:48
@Emyrk
Copy link
Member Author

Emyrk commented Apr 27, 2022

Rebased #1200

@Emyrk Emyrk closed this Apr 27, 2022
@misskniss misskniss added this to the V2 Beta milestone May 15, 2022
@ammario ammario deleted the stevenmasley/user_assign_role branch October 9, 2022 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants