Repository navigation
feat: Add template-admin + user-admin role for managing templates + users - #3490
Conversation
Might want to make this an org role in the future. Also also shows assignable roles in the ui.
|
@mafredri I made a |
| Name: "MyWorkspaceInOrgExecution", | ||
| // When creating the WithID won't be set, but it does not change the result. | ||
| Actions: []rbac.Action{rbac.ActionCreate, rbac.ActionRead, rbac.ActionUpdate, rbac.ActionDelete}, | ||
| Resource: rbac.ResourceWorkspaceExecution.InOrg(orgID).WithOwner(currentUser.String()), | ||
| AuthorizeMap: map[bool][]authSubject{ | ||
| true: {admin, orgAdmin, orgMemberMe}, | ||
| false: {memberMe, otherOrgAdmin, otherOrgMember, templateAdmin, userAdmin}, |
There was a problem hiding this comment.
Workspace execution can only be done by admin, orgadmin and the owner of the workspace.
mafredri
left a comment
There was a problem hiding this comment.
The new role was a nice addition!
| workspaceAgent := httpmw.WorkspaceAgentParam(r) | ||
| workspace := httpmw.WorkspaceParam(r) | ||
| if !api.Authorize(r, rbac.ActionUpdate, workspace) { | ||
| if !api.Authorize(r, rbac.ActionCreate, workspace.ExecutionRBAC()) { |
There was a problem hiding this comment.
I didn't quite catch why this changed from Update to Create. My intuition says it doesn't really matter. So it's probably fine but just checking.
There was a problem hiding this comment.
It doesn't. It's arbitrary.
But what I did change was I added ResourceWorkspaceExecution as a unique resource. So giving CRUD to a workspace does not grant execution via a tunnel. These are now distinct permissions.
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
What this does
Adds a
template-adminrole that has full CRUD to templates and files.Adds a
user-adminrole that has full CRUD on usersThoughts? Trying to partially solve #2135 by removing the need to promote everyone to admin.
Bonus
UI only shows assignable roles. So if you cannot assign a role, it won't appear in the dropdown. (Except for self assigning roles)
TODO:
Next PR will migrate "Admin" -> "Template Admin, User Admin"
And migrate the first user from "Admin" -> "Owner"