Skip to content

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

Closed
Emyrk wants to merge 9 commits into
mainfrom
stevenmasley/user_assign_role
Closed

feat: Add user roles, but do not yet enforce them#1199
Emyrk wants to merge 9 commits into
mainfrom
stevenmasley/user_assign_role

Conversation

@Emyrk
Copy link
Copy Markdown
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
Copy Markdown
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