MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / rbacEnabled

Function rbacEnabled

app/controlplane/internal/service/service.go:392–402  ·  view source on GitHub ↗

RBAC feature is enabled if we are using a project scoped token or it is a user with org role member

(ctx context.Context)

Source from the content-addressed store, hash-verified

390// RBAC feature is enabled if we are using a project scoped token or
391// it is a user with org role member
392func rbacEnabled(ctx context.Context) bool {
393 // it's an API token
394 token := entities.CurrentAPIToken(ctx)
395 if token != nil {
396 return token.ProjectID != nil
397 }
398
399 // we have an user
400 currentSubject := usercontext.CurrentAuthzSubject(ctx)
401 return authz.Role(currentSubject).RBACEnabled()
402}
403
404// NOTE: some of these http errors get automatically translated to gRPC status codes
405// because they implement the gRPC status error interface

Callers 9

CreateMethod · 0.85
checkContractAccessMethod · 0.85
CreateMethod · 0.85
RevokeMethod · 0.85
authorizeResourceMethod · 0.85
userCanCreateProjectMethod · 0.85
visibleProjectsMethod · 0.85
GetContractMethod · 0.85

Calls 4

CurrentAPITokenFunction · 0.92
CurrentAuthzSubjectFunction · 0.92
RoleTypeAlias · 0.92
RBACEnabledMethod · 0.80

Tested by

no test coverage detected