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

Commitff6552e

Browse files
committed
update roles
1 parent4344ed2 commitff6552e

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

‎coderd/rbac/policy.rego‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ user_allow(roles) := num if {
255255
# 'org_member' applies if the object is owned by both the user and an organization.
256256
# It replaces the `user` permissions in this case.
257257
defaultorg_member:=0
258-
org_member_owner:= num if{
258+
org_member:= num if{
259259
# Object must be jointly owned by the user
260260
input.object.owner!=""
261261
input.subject.id= input.object.owner
262262
num:=org_allow(input.subject.roles,"org_member")
263263
}
264264

265-
defaultscope_org_member_owner:=0
266-
scope_org_member_owner:= num if{
265+
defaultscope_org_member:=0
266+
scope_org_member:= num if{
267267
# Object must be jointly owned by the user
268268
input.object.owner!=""
269269
input.subject.id= input.object.owner
@@ -368,7 +368,7 @@ scope_allow if { # scope org member auth
368368
notscope_org=-1
369369

370370
# Organization member owner permissions require both ownership and org membership
371-
scope_org_member_owner=1
371+
scope_org_member=1
372372
}
373373

374374
# -------------------

‎coderd/rbac/roles.go‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,11 @@ func ReloadBuiltinRoles(opts *RoleOptions) {
296296
ResourceWorkspaceProxy.Type: {policy.ActionRead},
297297
}),
298298
Org:map[string][]Permission{},
299-
User:append(allPermsExcept(ResourceWorkspaceDormant,ResourcePrebuiltWorkspace,ResourceUser,ResourceOrganizationMember),
299+
User:append(allPermsExcept(ResourceWorkspace,ResourceWorkspaceDormant,ResourcePrebuiltWorkspace,ResourceUser,ResourceOrganizationMember),
300300
Permissions(map[string][]policy.Action{
301-
// Reduced permission set on dormant workspaces. No build, ssh, or exec
302-
ResourceWorkspaceDormant.Type: {policy.ActionRead,policy.ActionDelete,policy.ActionCreate,policy.ActionUpdate,policy.ActionWorkspaceStop,policy.ActionCreateAgent,policy.ActionDeleteAgent},
303301
// Users cannot do create/update/delete on themselves, but they
304302
// can read their own details.
305303
ResourceUser.Type: {policy.ActionRead,policy.ActionReadPersonal,policy.ActionUpdatePersonal},
306-
// Can read their own organization member record
307-
ResourceOrganizationMember.Type: {policy.ActionRead},
308304
// Users can create provisioner daemons scoped to themselves.
309305
ResourceProvisionerDaemon.Type: {policy.ActionRead,policy.ActionCreate,policy.ActionRead,policy.ActionUpdate},
310306
})...,
@@ -454,8 +450,16 @@ func ReloadBuiltinRoles(opts *RoleOptions) {
454450
ResourceAssignOrgRole.Type: {policy.ActionRead},
455451
}),
456452
},
457-
User: []Permission{},
458-
OrgMember:map[string][]Permission{},
453+
User: []Permission{},
454+
OrgMember:map[string][]Permission{
455+
organizationID.String():Permissions(map[string][]policy.Action{
456+
ResourceWorkspace.Type:ResourceWorkspace.AvailableActions(),
457+
// Reduced permission set on dormant workspaces. No build, ssh, or exec
458+
ResourceWorkspaceDormant.Type: {policy.ActionRead,policy.ActionDelete,policy.ActionCreate,policy.ActionUpdate,policy.ActionWorkspaceStop,policy.ActionCreateAgent,policy.ActionDeleteAgent},
459+
// Can read their own organization member record
460+
ResourceOrganizationMember.Type: {policy.ActionRead},
461+
}),
462+
},
459463
}
460464
},
461465
orgAuditor:func(organizationID uuid.UUID)Role {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp