RBAC feature is enabled if we are using a project scoped token or it is a user with org role member
(ctx context.Context)
| 390 | // RBAC feature is enabled if we are using a project scoped token or |
| 391 | // it is a user with org role member |
| 392 | func 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 |
no test coverage detected