@@ -399,59 +399,59 @@ var (
399
399
// AsProvisionerd returns a context with an actor that has permissions required
400
400
// for provisionerd to function.
401
401
func AsProvisionerd (ctx context.Context ) context.Context {
402
- return InjectActorToContext (ctx ,subjectProvisionerd )
402
+ return As (ctx ,subjectProvisionerd )
403
403
}
404
404
405
405
// AsAutostart returns a context with an actor that has permissions required
406
406
// for autostart to function.
407
407
func AsAutostart (ctx context.Context ) context.Context {
408
- return InjectActorToContext (ctx ,subjectAutostart )
408
+ return As (ctx ,subjectAutostart )
409
409
}
410
410
411
411
// AsHangDetector returns a context with an actor that has permissions required
412
412
// for unhanger.Detector to function.
413
413
func AsHangDetector (ctx context.Context ) context.Context {
414
- return InjectActorToContext (ctx ,subjectHangDetector )
414
+ return As (ctx ,subjectHangDetector )
415
415
}
416
416
417
417
// AsKeyRotator returns a context with an actor that has permissions required for rotating crypto keys.
418
418
func AsKeyRotator (ctx context.Context ) context.Context {
419
- return InjectActorToContext (ctx ,subjectCryptoKeyRotator )
419
+ return As (ctx ,subjectCryptoKeyRotator )
420
420
}
421
421
422
422
// AsKeyReader returns a context with an actor that has permissions required for reading crypto keys.
423
423
func AsKeyReader (ctx context.Context ) context.Context {
424
- return InjectActorToContext (ctx ,subjectCryptoKeyReader )
424
+ return As (ctx ,subjectCryptoKeyReader )
425
425
}
426
426
427
427
// AsNotifier returns a context with an actor that has permissions required for
428
428
// creating/reading/updating/deleting notifications.
429
429
func AsNotifier (ctx context.Context ) context.Context {
430
- return InjectActorToContext (ctx ,subjectNotifier )
430
+ return As (ctx ,subjectNotifier )
431
431
}
432
432
433
433
// AsResourceMonitor returns a context with an actor that has permissions required for
434
434
// updating resource monitors.
435
435
func AsResourceMonitor (ctx context.Context ) context.Context {
436
- return InjectActorToContext (ctx ,subjectResourceMonitor )
436
+ return As (ctx ,subjectResourceMonitor )
437
437
}
438
438
439
439
// AsSystemRestricted returns a context with an actor that has permissions
440
440
// required for various system operations (login, logout, metrics cache).
441
441
func AsSystemRestricted (ctx context.Context ) context.Context {
442
- return InjectActorToContext (ctx ,subjectSystemRestricted )
442
+ return As (ctx ,subjectSystemRestricted )
443
443
}
444
444
445
445
// AsSystemReadProvisionerDaemons returns a context with an actor that has permissions
446
446
// to read provisioner daemons.
447
447
func AsSystemReadProvisionerDaemons (ctx context.Context ) context.Context {
448
- return InjectActorToContext (ctx ,subjectSystemReadProvisionerDaemons )
448
+ return As (ctx ,subjectSystemReadProvisionerDaemons )
449
449
}
450
450
451
451
// AsPrebuildsOrchestrator returns a context with an actor that has permissions
452
452
// to read orchestrator workspace prebuilds.
453
453
func AsPrebuildsOrchestrator (ctx context.Context ) context.Context {
454
- return InjectActorToContext (ctx ,subjectPrebuildsOrchestrator )
454
+ return As (ctx ,subjectPrebuildsOrchestrator )
455
455
}
456
456
457
457
var AsRemoveActor = rbac.Subject {
@@ -469,10 +469,6 @@ func As(ctx context.Context, actor rbac.Subject) context.Context {
469
469
// should be removed from the context.
470
470
return context .WithValue (ctx ,authContextKey {},nil )
471
471
}
472
- return InjectActorToContext (ctx ,actor )
473
- }
474
-
475
- func InjectActorToContext (ctx context.Context ,actor rbac.Subject ) context.Context {
476
472
if rlogger := loggermw .RequestLoggerFromContext (ctx );rlogger != nil {
477
473
rlogger .WithAuthContext (actor )
478
474
}