-
Notifications
You must be signed in to change notification settings - Fork 577
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
chore: implement api for creating custom roles #13298
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ba10185
to
ef8c950
Compare
ad4023b
to
c1c3891
Compare
4060c07
to
c58a6fd
Compare
c1c3891
to
af25ebb
Compare
c58a6fd
to
88ca559
Compare
af25ebb
to
8abb57e
Compare
88ca559
to
96d1527
Compare
f1c61bd
to
e5613b2
Compare
|
||
// UpsertCustomSiteRole will upsert a custom site wide role | ||
func (c *Client) UpsertCustomSiteRole(ctx context.Context, req Role) (Role, error) { | ||
res, err := c.Request(ctx, http.MethodPatch, "/api/v2/users/roles", req) |
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.
/api/v2/users/roles
seems like a weird place to mount this 🤔
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.
Yea? That is where the roles api currently is. Any suggestions?
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.
Wouldn't they be org-scoped?
EDIT: Ah no, they can have user, org, and site perms.
Honestly I'd put them under a separate /api/v2/roles
endpoint but I think that's definitely out of scope of this PR.
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.
These roles are site scoped.
There is a /roles
under /organizations/{organization}/members/roles
for org scoped roles.
4259691
to
e0cdcdd
Compare
// Verify the role exists in the list | ||
// TODO: Turn this assertion back on when the cli api experience is created. | ||
//allRoles, err := tmplAdmin.ListSiteRoles(ctx) | ||
//require.NoError(t, err) | ||
// | ||
//require.True(t, slices.ContainsFunc(allRoles, func(selected codersdk.AssignableRoles) bool { | ||
// return selected.Name == role.Name | ||
//}), "role missing from site role list") |
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.
To prevent this PR from growing anymore, I am going to push this to the next PR. Essentially, from a UI perspective, our existing role endpoints do not fetch custom roles.
Since there is no UI or cli in this PR and this is already large, I am going to intentionally not solve this here (and this is gated behind an experiment).
96d1527
to
992c845
Compare
07d531d
to
28477ba
Compare
992c845
to
a6996f6
Compare
75e7bd8
to
747fc79
Compare
801e054
to
68807ac
Compare
No description provided.