1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-02 01:17:58 +02:00

chore: remove group root role toggle (#4026)

This commit is contained in:
Simon Hornby 2023-07-05 14:33:33 +02:00 committed by GitHub
parent 9f5b7b610a
commit b0e4c8a57e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 36 deletions

View File

@ -12,7 +12,6 @@ import { Link } from 'react-router-dom';
import { HelpIcon } from 'component/common/HelpIcon/HelpIcon'; import { HelpIcon } from 'component/common/HelpIcon/HelpIcon';
import { IRole } from 'interfaces/role'; import { IRole } from 'interfaces/role';
import { useUsers } from 'hooks/api/getters/useUsers/useUsers'; import { useUsers } from 'hooks/api/getters/useUsers/useUsers';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
import { RoleSelect } from 'component/common/RoleSelect/RoleSelect'; import { RoleSelect } from 'component/common/RoleSelect/RoleSelect';
const StyledForm = styled('form')(() => ({ const StyledForm = styled('form')(() => ({
@ -111,15 +110,12 @@ export const GroupForm: FC<IGroupForm> = ({
}) => { }) => {
const { config: oidcSettings } = useAuthSettings('oidc'); const { config: oidcSettings } = useAuthSettings('oidc');
const { config: samlSettings } = useAuthSettings('saml'); const { config: samlSettings } = useAuthSettings('saml');
const { uiConfig } = useUiConfig();
const { roles } = useUsers(); const { roles } = useUsers();
const isGroupSyncingEnabled = const isGroupSyncingEnabled =
(oidcSettings?.enabled && oidcSettings.enableGroupSyncing) || (oidcSettings?.enabled && oidcSettings.enableGroupSyncing) ||
(samlSettings?.enabled && samlSettings.enableGroupSyncing); (samlSettings?.enabled && samlSettings.enableGroupSyncing);
const groupRootRolesEnabled = Boolean(uiConfig.flags.groupRootRoles);
const roleIdToRole = (rootRoleId: number | null): IRole | null => { const roleIdToRole = (rootRoleId: number | null): IRole | null => {
return roles.find((role: IRole) => role.id === rootRoleId) || null; return roles.find((role: IRole) => role.id === rootRoleId) || null;
}; };
@ -180,30 +176,20 @@ export const GroupForm: FC<IGroupForm> = ({
</StyledDescriptionBlock> </StyledDescriptionBlock>
)} )}
/> />
<ConditionallyRender <StyledInputDescription>
condition={groupRootRolesEnabled} <Box sx={{ display: 'flex' }}>
show={ Do you want to associate a root role with this group?
<> <HelpIcon tooltip="When you associate an Admin or Editor role with this group, users in this group will automatically inherit the role globally. Note that groups with a root role association cannot be assigned to projects." />
<StyledInputDescription> </Box>
<Box sx={{ display: 'flex' }}> </StyledInputDescription>
Do you want to associate a root role with <StyledAutocompleteWrapper>
this group? <RoleSelect
<HelpIcon tooltip="When you associate an Admin or Editor role with this group, users in this group will automatically inherit the role globally. Note that groups with a root role association cannot be assigned to projects." /> data-testid="GROUP_ROOT_ROLE"
</Box> roles={roles}
</StyledInputDescription> value={roleIdToRole(rootRole)}
<StyledAutocompleteWrapper> setValue={role => setRootRole(role?.id || null)}
<RoleSelect />
data-testid="GROUP_ROOT_ROLE" </StyledAutocompleteWrapper>
roles={roles}
value={roleIdToRole(rootRole)}
setValue={role =>
setRootRole(role?.id || null)
}
/>
</StyledAutocompleteWrapper>
</>
}
/>
<ConditionallyRender <ConditionallyRender
condition={mode === 'Create'} condition={mode === 'Create'}
show={ show={

View File

@ -46,7 +46,6 @@ export interface IFlags {
notifications?: boolean; notifications?: boolean;
personalAccessTokensKillSwitch?: boolean; personalAccessTokensKillSwitch?: boolean;
demo?: boolean; demo?: boolean;
groupRootRoles?: boolean;
googleAuthEnabled?: boolean; googleAuthEnabled?: boolean;
disableBulkToggle?: boolean; disableBulkToggle?: boolean;
segmentContextFieldUsage?: boolean; segmentContextFieldUsage?: boolean;

View File

@ -79,7 +79,6 @@ exports[`should create default config 1`] = `
"embedProxyFrontend": true, "embedProxyFrontend": true,
"featuresExportImport": true, "featuresExportImport": true,
"googleAuthEnabled": false, "googleAuthEnabled": false,
"groupRootRoles": false,
"maintenanceMode": false, "maintenanceMode": false,
"messageBanner": { "messageBanner": {
"enabled": false, "enabled": false,
@ -112,7 +111,6 @@ exports[`should create default config 1`] = `
"embedProxyFrontend": true, "embedProxyFrontend": true,
"featuresExportImport": true, "featuresExportImport": true,
"googleAuthEnabled": false, "googleAuthEnabled": false,
"groupRootRoles": false,
"maintenanceMode": false, "maintenanceMode": false,
"messageBanner": { "messageBanner": {
"enabled": false, "enabled": false,

View File

@ -15,7 +15,6 @@ export type IFlagKey =
| 'proPlanAutoCharge' | 'proPlanAutoCharge'
| 'personalAccessTokensKillSwitch' | 'personalAccessTokensKillSwitch'
| 'cleanClientApi' | 'cleanClientApi'
| 'groupRootRoles'
| 'migrationLock' | 'migrationLock'
| 'demo' | 'demo'
| 'googleAuthEnabled' | 'googleAuthEnabled'
@ -79,10 +78,6 @@ const flags: IFlags = {
false, false,
), ),
cleanClientApi: parseEnvVarBoolean(process.env.CLEAN_CLIENT_API, false), cleanClientApi: parseEnvVarBoolean(process.env.CLEAN_CLIENT_API, false),
groupRootRoles: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_ROOT_ROLE_GROUPS,
false,
),
migrationLock: parseEnvVarBoolean(process.env.MIGRATION_LOCK, false), migrationLock: parseEnvVarBoolean(process.env.MIGRATION_LOCK, false),
demo: parseEnvVarBoolean(process.env.UNLEASH_DEMO, false), demo: parseEnvVarBoolean(process.env.UNLEASH_DEMO, false),
strategySplittedButton: parseEnvVarBoolean( strategySplittedButton: parseEnvVarBoolean(