mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Auth: Add no role frontend feature flag (#72823)
* Add 'noBasicRole' feature flag * Hide role options and tooltip with feature flag * Add feature flag to registry
This commit is contained in:
parent
0b9bb97982
commit
64ed77ddce
@ -129,6 +129,7 @@ Experimental features might be changed or removed without prior notice.
|
|||||||
| `permissionsFilterRemoveSubquery` | Alternative permission filter implementation that does not use subqueries for fetching the dashboard folder |
|
| `permissionsFilterRemoveSubquery` | Alternative permission filter implementation that does not use subqueries for fetching the dashboard folder |
|
||||||
| `prometheusConfigOverhaulAuth` | Update the Prometheus configuration page with the new auth component |
|
| `prometheusConfigOverhaulAuth` | Update the Prometheus configuration page with the new auth component |
|
||||||
| `influxdbSqlSupport` | Enable InfluxDB SQL query language support with new querying UI |
|
| `influxdbSqlSupport` | Enable InfluxDB SQL query language support with new querying UI |
|
||||||
|
| `noBasicRole` | Enables a new role that has no permissions by default |
|
||||||
|
|
||||||
## Development feature toggles
|
## Development feature toggles
|
||||||
|
|
||||||
|
@ -118,4 +118,5 @@ export interface FeatureToggles {
|
|||||||
prometheusConfigOverhaulAuth?: boolean;
|
prometheusConfigOverhaulAuth?: boolean;
|
||||||
configurableSchedulerTick?: boolean;
|
configurableSchedulerTick?: boolean;
|
||||||
influxdbSqlSupport?: boolean;
|
influxdbSqlSupport?: boolean;
|
||||||
|
noBasicRole?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -691,5 +691,13 @@ var (
|
|||||||
Owner: grafanaObservabilityMetricsSquad,
|
Owner: grafanaObservabilityMetricsSquad,
|
||||||
RequiresRestart: false,
|
RequiresRestart: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "noBasicRole",
|
||||||
|
Description: "Enables a new role that has no permissions by default",
|
||||||
|
Stage: FeatureStageExperimental,
|
||||||
|
FrontendOnly: true,
|
||||||
|
Owner: grafanaAuthnzSquad,
|
||||||
|
RequiresRestart: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -99,3 +99,4 @@ permissionsFilterRemoveSubquery,experimental,@grafana/backend-platform,false,fal
|
|||||||
prometheusConfigOverhaulAuth,experimental,@grafana/observability-metrics,false,false,false,false
|
prometheusConfigOverhaulAuth,experimental,@grafana/observability-metrics,false,false,false,false
|
||||||
configurableSchedulerTick,experimental,@grafana/alerting-squad,false,false,true,false
|
configurableSchedulerTick,experimental,@grafana/alerting-squad,false,false,true,false
|
||||||
influxdbSqlSupport,experimental,@grafana/observability-metrics,false,false,false,false
|
influxdbSqlSupport,experimental,@grafana/observability-metrics,false,false,false,false
|
||||||
|
noBasicRole,experimental,@grafana/grafana-authnz-team,false,false,true,true
|
||||||
|
|
@ -406,4 +406,8 @@ const (
|
|||||||
// FlagInfluxdbSqlSupport
|
// FlagInfluxdbSqlSupport
|
||||||
// Enable InfluxDB SQL query language support with new querying UI
|
// Enable InfluxDB SQL query language support with new querying UI
|
||||||
FlagInfluxdbSqlSupport = "influxdbSqlSupport"
|
FlagInfluxdbSqlSupport = "influxdbSqlSupport"
|
||||||
|
|
||||||
|
// FlagNoBasicRole
|
||||||
|
// Enables a new role that has no permissions by default
|
||||||
|
FlagNoBasicRole = "noBasicRole"
|
||||||
)
|
)
|
||||||
|
@ -1,15 +1,23 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { Icon, RadioButtonList, Tooltip, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Icon, RadioButtonList, Tooltip, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
|
import { contextSrv } from 'app/core/core';
|
||||||
import { OrgRole } from 'app/types';
|
import { OrgRole } from 'app/types';
|
||||||
|
|
||||||
import { getStyles } from './styles';
|
import { getStyles } from './styles';
|
||||||
|
|
||||||
const BasicRoleOption: Array<SelectableValue<OrgRole>> = Object.values(OrgRole).map((r) => ({
|
const noBasicRoleFlag = contextSrv.licensedAccessControlEnabled();
|
||||||
label: r === OrgRole.None ? 'No basic role' : r,
|
|
||||||
value: r,
|
const noBasicRole = config.featureToggles.noBasicRole && noBasicRoleFlag;
|
||||||
}));
|
|
||||||
|
const BasicRoleOption: Array<SelectableValue<OrgRole>> = Object.values(OrgRole)
|
||||||
|
.filter((r) => noBasicRole || r !== OrgRole.None)
|
||||||
|
.map((r) => ({
|
||||||
|
label: r === OrgRole.None ? 'No basic role' : r,
|
||||||
|
value: r,
|
||||||
|
}));
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value?: OrgRole;
|
value?: OrgRole;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { css, cx } from '@emotion/css';
|
import { css, cx } from '@emotion/css';
|
||||||
import React, { useEffect, useRef, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { Button, CustomScrollbar, HorizontalGroup, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Button, CustomScrollbar, HorizontalGroup, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
import { getSelectStyles } from '@grafana/ui/src/components/Select/getSelectStyles';
|
import { getSelectStyles } from '@grafana/ui/src/components/Select/getSelectStyles';
|
||||||
import { contextSrv } from 'app/core/core';
|
import { contextSrv } from 'app/core/core';
|
||||||
@ -35,7 +36,7 @@ const fixedRoleGroupNames: Record<string, string> = {
|
|||||||
current: 'Current org',
|
current: 'Current org',
|
||||||
};
|
};
|
||||||
|
|
||||||
const noBasicRoleFlag = contextSrv.licensedAccessControlEnabled();
|
const noBasicRoleFlag = contextSrv.licensedAccessControlEnabled() && config.featureToggles.noBasicRole;
|
||||||
const tooltipMessage = noBasicRoleFlag
|
const tooltipMessage = noBasicRoleFlag
|
||||||
? 'You can now select the "No basic role" option and add permissions to your custom needs.'
|
? 'You can now select the "No basic role" option and add permissions to your custom needs.'
|
||||||
: undefined;
|
: undefined;
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import { locationUtil, SelectableValue } from '@grafana/data';
|
import { locationUtil, SelectableValue } from '@grafana/data';
|
||||||
import { Stack } from '@grafana/experimental';
|
import { Stack } from '@grafana/experimental';
|
||||||
import { locationService } from '@grafana/runtime';
|
import { config, locationService } from '@grafana/runtime';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
LinkButton,
|
LinkButton,
|
||||||
@ -23,7 +23,7 @@ import { OrgRole, useDispatch } from 'app/types';
|
|||||||
|
|
||||||
import { addInvitee } from '../invites/state/actions';
|
import { addInvitee } from '../invites/state/actions';
|
||||||
|
|
||||||
const noBasicRoleFlag = contextSrv.licensedAccessControlEnabled();
|
const noBasicRoleFlag = contextSrv.licensedAccessControlEnabled() && config.featureToggles.noBasicRole;
|
||||||
|
|
||||||
const tooltipMessage = noBasicRoleFlag
|
const tooltipMessage = noBasicRoleFlag
|
||||||
? 'You can now select the "No basic role" option and add permissions to your custom needs.'
|
? 'You can now select the "No basic role" option and add permissions to your custom needs.'
|
||||||
|
Loading…
Reference in New Issue
Block a user