@@ -30,47 +30,6 @@ func WithAuthorizeContext(ctx context.Context, actor rbac.Subject) context.Conte
30
30
return context .WithValue (ctx , authContextKey {}, actor )
31
31
}
32
32
33
- // WithWorkspaceAgentTokenContext returns a context with a workspace agent token
34
- // authorization subject. A workspace agent authorization subject is the
35
- // workspace owner's authorization subject + a workspace agent scope.
36
- //
37
- // TODO: The arguments and usage of this function are not finalized. It might
38
- // be a bit awkward to use at present. The arguments are required to build the
39
- // required authorization context. The arguments should be the owner of the
40
- // workspace authorization roles.
41
- func WithWorkspaceAgentTokenContext (ctx context.Context , workspaceID uuid.UUID , actorID uuid.UUID , roles rbac.ExpandableRoles , groups []string ) context.Context {
42
- // TODO: This workspace ID should be applied in the scope.
43
- var _ = workspaceID
44
- return context .WithValue (ctx , authContextKey {}, rbac.Subject {
45
- ID : actorID .String (),
46
- Roles : roles ,
47
- Scope : rbac.Scope {
48
- Role : rbac.Role {
49
- Name : "workspace-agent-scope" ,
50
- DisplayName : "Workspace Agent Scope" ,
51
- // TODO: More permissions are needed for the agent to work.
52
- Site : []rbac.Permission {
53
- {
54
- ResourceType : rbac .ResourceWorkspace .Type ,
55
- Action : rbac .ActionRead ,
56
- },
57
- {
58
- ResourceType : rbac .ResourceWorkspace .Type ,
59
- Action : rbac .ActionRead ,
60
- },
61
- // TODO: Read the workspace owner user.
62
- },
63
- Org : map [string ][]rbac.Permission {},
64
- User : []rbac.Permission {},
65
- },
66
- // TODO: We need to whitelist more resources such as the workspace
67
- // owner.
68
- AllowIDList : []string {workspaceID .String ()},
69
- },
70
- Groups : groups ,
71
- })
72
- }
73
-
74
33
// ActorFromContext returns the authorization subject from the context.
75
34
// All authentication flows should set the authorization subject in the context.
76
35
// If no actor is present, the function returns false.
0 commit comments