File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,9 @@ func (w WorkspaceTable) RBACObject() rbac.Object {
276
276
277
277
return rbac .ResourceWorkspace .WithID (w .ID ).
278
278
InOrg (w .OrganizationID ).
279
- WithOwner (w .OwnerID .String ())
279
+ WithOwner (w .OwnerID .String ()).
280
+ WithGroupACL (w .GroupACL .RBACACL ()).
281
+ WithACLUserList (w .UserACL .RBACACL ())
280
282
}
281
283
282
284
func (w WorkspaceTable ) DormantRBAC () rbac.Object {
Original file line number Diff line number Diff line change @@ -91,6 +91,16 @@ func (t *WorkspaceACL) Scan(src interface{}) error {
91
91
return xerrors .Errorf ("unexpected type %T" , src )
92
92
}
93
93
94
+ func (w WorkspaceACL ) RBACACL () map [string ][]policy.Action {
95
+ // Convert WorkspaceACL to a map of string to []policy.Action.
96
+ // This is used for RBAC checks.
97
+ rbacACL := make (map [string ][]policy.Action , len (w ))
98
+ for id , entry := range w {
99
+ rbacACL [id ] = entry .Permissions
100
+ }
101
+ return rbacACL
102
+ }
103
+
94
104
func (t WorkspaceACL ) Value () (driver.Value , error ) {
95
105
return json .Marshal (t )
96
106
}
You can’t perform that action at this time.
0 commit comments