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: Add template-admin + user-admin role for managing templates + users#3490

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 11 commits intomainfromstevenmasley/2135/roles
Aug 12, 2022

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedAug 12, 2022
edited
Loading

What this does

Adds atemplate-admin role that has full CRUD to templates and files.
Adds auser-admin role that has full CRUD on users

Thoughts? Trying to partially solve#2135 by removing the need to promote everyone to admin.

Screenshot from 2022-08-12 16-02-28

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"

Might want to make this an org role in the future.Also also shows assignable roles in the ui.
@EmyrkEmyrk mentioned this pull requestAug 12, 2022
Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

This looks good to me (although, do consider that my RBAC lingo is weak).

I wonder how much this will help towards#2135, though. I imagine#2135 is looking for a user that can also delete workspaces, but not inspect them.

@EmyrkEmyrk changed the titlefeat: Add template-manager role for managing templates site-widefeat: Add template-admin + user-admin role for managing templates + usersAug 12, 2022
@Emyrk
Copy link
MemberAuthor

@mafredri I made auser-admin role as well. Combined, I think they cover what an "admin" wants to be, and blocks workspace execution on other user's workspaces

Comment on lines +177 to +183
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},
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Workspace execution can only be done byadmin,orgadmin and the owner of the workspace.

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

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

The new role was a nice addition!

@@ -70,7 +70,7 @@ func (api *API) workspaceAgentDial(rw http.ResponseWriter, r *http.Request) {

workspaceAgent := httpmw.WorkspaceAgentParam(r)
workspace := httpmw.WorkspaceParam(r)
if !api.Authorize(r, rbac.ActionUpdate, workspace) {
if !api.Authorize(r, rbac.ActionCreate, workspace.ExecutionRBAC()) {
Copy link
Member

Choose a reason for hiding this comment

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

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It doesn't. It's arbitrary.

But what I did change was I addedResourceWorkspaceExecution as a unique resource. So giving CRUD to a workspacedoes not grant execution via a tunnel. These are now distinct permissions.

mafredri reacted with thumbs up emoji
@EmyrkEmyrk requested a review froma team as acode ownerAugust 12, 2022 20:57
Emyrkand others added2 commitsAugust 12, 2022 16:02
Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
@ammarioammario linked an issueAug 12, 2022 that may beclosed by this pull request
Copy link
Member

@Kira-PilotKira-Pilot left a comment

Choose a reason for hiding this comment

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

nicely done

Emyrk reacted with heart emoji
@EmyrkEmyrk merged commit40e68cb intomainAug 12, 2022
@EmyrkEmyrk deleted the stevenmasley/2135/roles branchAugust 12, 2022 22:27
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mafredrimafredrimafredri approved these changes

@Kira-PilotKira-PilotKira-Pilot approved these changes

@ammarioammarioAwaiting requested review from ammario

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

Successfully merging this pull request may close these issues.

Create lesser admin role
3 participants
@Emyrk@mafredri@Kira-Pilot

[8]ページ先頭

©2009-2025 Movatter.jp