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:
Mathias Fredriksson
2025-10-13 12:02:22 +03:00
committed by GitHub
parent d9f95f2285
commit 299a54a99b
19 changed files with 155 additions and 3 deletions
+10
View File
@@ -133,6 +133,11 @@ const (
APIKeyScopeTailnetCoordinatorDelete APIKeyScope = "tailnet_coordinator:delete"
APIKeyScopeTailnetCoordinatorRead APIKeyScope = "tailnet_coordinator:read"
APIKeyScopeTailnetCoordinatorUpdate APIKeyScope = "tailnet_coordinator:update"
APIKeyScopeTaskAll APIKeyScope = "task:*"
APIKeyScopeTaskCreate APIKeyScope = "task:create"
APIKeyScopeTaskDelete APIKeyScope = "task:delete"
APIKeyScopeTaskRead APIKeyScope = "task:read"
APIKeyScopeTaskUpdate APIKeyScope = "task:update"
APIKeyScopeTemplateAll APIKeyScope = "template:*"
APIKeyScopeTemplateCreate APIKeyScope = "template:create"
APIKeyScopeTemplateDelete APIKeyScope = "template:delete"
@@ -214,6 +219,11 @@ var PublicAPIKeyScopes = []APIKeyScope{
APIKeyScopeFileAll,
APIKeyScopeFileCreate,
APIKeyScopeFileRead,
APIKeyScopeTaskAll,
APIKeyScopeTaskCreate,
APIKeyScopeTaskDelete,
APIKeyScopeTaskRead,
APIKeyScopeTaskUpdate,
APIKeyScopeTemplateAll,
APIKeyScopeTemplateCreate,
APIKeyScopeTemplateDelete,
+2
View File
@@ -35,6 +35,7 @@ const (
ResourceReplicas RBACResource = "replicas"
ResourceSystem RBACResource = "system"
ResourceTailnetCoordinator RBACResource = "tailnet_coordinator"
ResourceTask RBACResource = "task"
ResourceTemplate RBACResource = "template"
ResourceUsageEvent RBACResource = "usage_event"
ResourceUser RBACResource = "user"
@@ -102,6 +103,7 @@ var RBACResourceActions = map[RBACResource][]RBACAction{
ResourceReplicas: {ActionRead},
ResourceSystem: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
ResourceTailnetCoordinator: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
ResourceTask: {ActionCreate, ActionDelete, ActionRead, ActionUpdate},
ResourceTemplate: {ActionCreate, ActionDelete, ActionRead, ActionUpdate, ActionUse, ActionViewInsights},
ResourceUsageEvent: {ActionCreate, ActionRead, ActionUpdate},
ResourceUser: {ActionCreate, ActionDelete, ActionRead, ActionReadPersonal, ActionUpdate, ActionUpdatePersonal},