chore: keep entitlements in the options only, simplify fields (#14434)

* chore: refactor entitlements to keep it in just the options

Duplicating the reference did not feel valuable, just confusing
This commit is contained in:
Steven Masley
2024-08-26 13:05:03 -05:00
committed by GitHub
parent fb6b954222
commit 93eef7b542
11 changed files with 27 additions and 25 deletions

View File

@ -14,7 +14,7 @@ import (
// nolint: revive
func (api *API) setUserGroups(ctx context.Context, logger slog.Logger, db database.Store, userID uuid.UUID, orgGroupNames map[uuid.UUID][]string, createMissingGroups bool) error {
if !api.entitlements.Enabled(codersdk.FeatureTemplateRBAC) {
if !api.Entitlements.Enabled(codersdk.FeatureTemplateRBAC) {
return nil
}
@ -78,7 +78,7 @@ func (api *API) setUserGroups(ctx context.Context, logger slog.Logger, db databa
}
func (api *API) setUserSiteRoles(ctx context.Context, logger slog.Logger, db database.Store, userID uuid.UUID, roles []string) error {
if !api.entitlements.Enabled(codersdk.FeatureUserRoleManagement) {
if !api.Entitlements.Enabled(codersdk.FeatureUserRoleManagement) {
logger.Warn(ctx, "attempted to assign OIDC user roles without enterprise entitlement, roles left unchanged",
slog.F("user_id", userID), slog.F("roles", roles),
)