Skip to content

Commit e42dc76

Browse files
committed
removed unnecessary call
1 parent 4be8cd7 commit e42dc76

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

coderd/database/dbauthz/dbauthz.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -399,59 +399,59 @@ var (
399399
// AsProvisionerd returns a context with an actor that has permissions required
400400
// for provisionerd to function.
401401
func AsProvisionerd(ctx context.Context) context.Context {
402-
return InjectActorToContext(ctx, subjectProvisionerd)
402+
return As(ctx, subjectProvisionerd)
403403
}
404404

405405
// AsAutostart returns a context with an actor that has permissions required
406406
// for autostart to function.
407407
func AsAutostart(ctx context.Context) context.Context {
408-
return InjectActorToContext(ctx, subjectAutostart)
408+
return As(ctx, subjectAutostart)
409409
}
410410

411411
// AsHangDetector returns a context with an actor that has permissions required
412412
// for unhanger.Detector to function.
413413
func AsHangDetector(ctx context.Context) context.Context {
414-
return InjectActorToContext(ctx, subjectHangDetector)
414+
return As(ctx, subjectHangDetector)
415415
}
416416

417417
// AsKeyRotator returns a context with an actor that has permissions required for rotating crypto keys.
418418
func AsKeyRotator(ctx context.Context) context.Context {
419-
return InjectActorToContext(ctx, subjectCryptoKeyRotator)
419+
return As(ctx, subjectCryptoKeyRotator)
420420
}
421421

422422
// AsKeyReader returns a context with an actor that has permissions required for reading crypto keys.
423423
func AsKeyReader(ctx context.Context) context.Context {
424-
return InjectActorToContext(ctx, subjectCryptoKeyReader)
424+
return As(ctx, subjectCryptoKeyReader)
425425
}
426426

427427
// AsNotifier returns a context with an actor that has permissions required for
428428
// creating/reading/updating/deleting notifications.
429429
func AsNotifier(ctx context.Context) context.Context {
430-
return InjectActorToContext(ctx, subjectNotifier)
430+
return As(ctx, subjectNotifier)
431431
}
432432

433433
// AsResourceMonitor returns a context with an actor that has permissions required for
434434
// updating resource monitors.
435435
func AsResourceMonitor(ctx context.Context) context.Context {
436-
return InjectActorToContext(ctx, subjectResourceMonitor)
436+
return As(ctx, subjectResourceMonitor)
437437
}
438438

439439
// AsSystemRestricted returns a context with an actor that has permissions
440440
// required for various system operations (login, logout, metrics cache).
441441
func AsSystemRestricted(ctx context.Context) context.Context {
442-
return InjectActorToContext(ctx, subjectSystemRestricted)
442+
return As(ctx, subjectSystemRestricted)
443443
}
444444

445445
// AsSystemReadProvisionerDaemons returns a context with an actor that has permissions
446446
// to read provisioner daemons.
447447
func AsSystemReadProvisionerDaemons(ctx context.Context) context.Context {
448-
return InjectActorToContext(ctx, subjectSystemReadProvisionerDaemons)
448+
return As(ctx, subjectSystemReadProvisionerDaemons)
449449
}
450450

451451
// AsPrebuildsOrchestrator returns a context with an actor that has permissions
452452
// to read orchestrator workspace prebuilds.
453453
func AsPrebuildsOrchestrator(ctx context.Context) context.Context {
454-
return InjectActorToContext(ctx, subjectPrebuildsOrchestrator)
454+
return As(ctx, subjectPrebuildsOrchestrator)
455455
}
456456

457457
var AsRemoveActor = rbac.Subject{
@@ -469,10 +469,6 @@ func As(ctx context.Context, actor rbac.Subject) context.Context {
469469
// should be removed from the context.
470470
return context.WithValue(ctx, authContextKey{}, nil)
471471
}
472-
return InjectActorToContext(ctx, actor)
473-
}
474-
475-
func InjectActorToContext(ctx context.Context, actor rbac.Subject) context.Context {
476472
if rlogger := loggermw.RequestLoggerFromContext(ctx); rlogger != nil {
477473
rlogger.WithAuthContext(actor)
478474
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy