feat: add workspace acls to task rbac objects (#22311)

To allow tasks to be shareable, we need to share both the `task`
resource and the `workspace` resource, and their sharing state needs to
be kept in sync. We've already implemented all of the necessary ACL
functionality for workspaces, so we can just sort of proxy those ACLs
back to the task as well.
This commit is contained in:
Kayla はな
2026-03-05 13:40:53 -07:00
committed by GitHub
parent 719c24829a
commit 56bdea73b8
9 changed files with 365 additions and 49 deletions
+14 -5
View File
@@ -155,14 +155,23 @@ func (t Task) TaskTable() TaskTable {
}
func (t Task) RBACObject() rbac.Object {
return t.TaskTable().RBACObject()
}
func (t TaskTable) RBACObject() rbac.Object {
return rbac.ResourceTask.
obj := rbac.ResourceTask.
WithID(t.ID).
WithOwner(t.OwnerID.String()).
InOrg(t.OrganizationID)
if rbac.WorkspaceACLDisabled() {
return obj
}
if t.WorkspaceGroupACL != nil {
obj = obj.WithGroupACL(t.WorkspaceGroupACL.RBACACL())
}
if t.WorkspaceUserACL != nil {
obj = obj.WithACLUserList(t.WorkspaceUserACL.RBACACL())
}
return obj
}
func (c Chat) RBACObject() rbac.Object {