Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/auth/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ type PresetRoleManager interface {
// GetPresetRoles returns a list of all preset roles expected to be available on
// this cluster.
func GetPresetRoles() []types.Role {
return []types.Role{
presets := []types.Role{
services.NewPresetGroupAccessRole(),
services.NewPresetEditorRole(),
services.NewPresetAccessRole(),
Expand All @@ -765,6 +765,11 @@ func GetPresetRoles() []types.Role {
services.NewPresetDeviceEnrollRole(),
services.NewPresetRequireTrustedDeviceRole(),
}

// Certain `New$FooRole()` functions will return a nil role if the
// corresponding feature is disabled. They should be filtered out as they
// are not actually made available on the cluster.
return slices.DeleteFunc(presets, func(r types.Role) bool { return r == nil })
}

// createPresetRoles creates preset role resources
Expand Down