mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(coderd): add tasks rbac object (#20234)
This change adds RBAC for tasks. Updates coder/internal#948 Supersedes coder/coder#20212
This commit is contained in:
@@ -206,6 +206,11 @@ const (
|
||||
ApiKeyScopeWorkspaceAgentResourceMonitor APIKeyScope = "workspace_agent_resource_monitor:*"
|
||||
ApiKeyScopeWorkspaceDormant APIKeyScope = "workspace_dormant:*"
|
||||
ApiKeyScopeWorkspaceProxy APIKeyScope = "workspace_proxy:*"
|
||||
ApiKeyScopeTaskCreate APIKeyScope = "task:create"
|
||||
ApiKeyScopeTaskRead APIKeyScope = "task:read"
|
||||
ApiKeyScopeTaskUpdate APIKeyScope = "task:update"
|
||||
ApiKeyScopeTaskDelete APIKeyScope = "task:delete"
|
||||
ApiKeyScopeTask APIKeyScope = "task:*"
|
||||
)
|
||||
|
||||
func (e *APIKeyScope) Scan(src interface{}) error {
|
||||
@@ -431,7 +436,12 @@ func (e APIKeyScope) Valid() bool {
|
||||
ApiKeyScopeWorkspaceAgentDevcontainers,
|
||||
ApiKeyScopeWorkspaceAgentResourceMonitor,
|
||||
ApiKeyScopeWorkspaceDormant,
|
||||
ApiKeyScopeWorkspaceProxy:
|
||||
ApiKeyScopeWorkspaceProxy,
|
||||
ApiKeyScopeTaskCreate,
|
||||
ApiKeyScopeTaskRead,
|
||||
ApiKeyScopeTaskUpdate,
|
||||
ApiKeyScopeTaskDelete,
|
||||
ApiKeyScopeTask:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -626,6 +636,11 @@ func AllAPIKeyScopeValues() []APIKeyScope {
|
||||
ApiKeyScopeWorkspaceAgentResourceMonitor,
|
||||
ApiKeyScopeWorkspaceDormant,
|
||||
ApiKeyScopeWorkspaceProxy,
|
||||
ApiKeyScopeTaskCreate,
|
||||
ApiKeyScopeTaskRead,
|
||||
ApiKeyScopeTaskUpdate,
|
||||
ApiKeyScopeTaskDelete,
|
||||
ApiKeyScopeTask,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user