Chore: remove DisableSyncLock setting, as it's not used anymore (#72680)

* rmeove DisableSyncLock setting, as it's not used anymore

* remove unused import
This commit is contained in:
Ieva 2023-08-01 15:38:07 +01:00 committed by GitHub
parent 91c7096eda
commit 1fa4f4bc57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 13 deletions

View File

@ -239,6 +239,5 @@ export interface AuthSettings {
AzureADSkipOrgRoleSync?: boolean; AzureADSkipOrgRoleSync?: boolean;
GoogleSkipOrgRoleSync?: boolean; GoogleSkipOrgRoleSync?: boolean;
GenericOAuthSkipOrgRoleSync?: boolean; GenericOAuthSkipOrgRoleSync?: boolean;
DisableSyncLock?: boolean;
AuthProxyEnableLoginToken?: boolean; AuthProxyEnableLoginToken?: boolean;
} }

View File

@ -17,7 +17,6 @@ type FrontendSettingsAuthDTO struct {
GithubSkipOrgRoleSync bool `json:"GithubSkipOrgRoleSync"` GithubSkipOrgRoleSync bool `json:"GithubSkipOrgRoleSync"`
GitLabSkipOrgRoleSync bool `json:"GitLabSkipOrgRoleSync"` GitLabSkipOrgRoleSync bool `json:"GitLabSkipOrgRoleSync"`
OktaSkipOrgRoleSync bool `json:"OktaSkipOrgRoleSync"` OktaSkipOrgRoleSync bool `json:"OktaSkipOrgRoleSync"`
DisableSyncLock bool `json:"DisableSyncLock"`
AuthProxyEnableLoginToken bool `json:"AuthProxyEnableLoginToken"` AuthProxyEnableLoginToken bool `json:"AuthProxyEnableLoginToken"`
} }

View File

@ -165,7 +165,6 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
GithubSkipOrgRoleSync: hs.Cfg.GitHubSkipOrgRoleSync, GithubSkipOrgRoleSync: hs.Cfg.GitHubSkipOrgRoleSync,
GitLabSkipOrgRoleSync: hs.Cfg.GitLabSkipOrgRoleSync, GitLabSkipOrgRoleSync: hs.Cfg.GitLabSkipOrgRoleSync,
OktaSkipOrgRoleSync: hs.Cfg.OktaSkipOrgRoleSync, OktaSkipOrgRoleSync: hs.Cfg.OktaSkipOrgRoleSync,
DisableSyncLock: hs.Cfg.DisableSyncLock,
AuthProxyEnableLoginToken: hs.Cfg.AuthProxyEnableLoginToken, AuthProxyEnableLoginToken: hs.Cfg.AuthProxyEnableLoginToken,
}, },

View File

@ -275,7 +275,6 @@ type Cfg struct {
AdminPassword string AdminPassword string
DisableLogin bool DisableLogin bool
AdminEmail string AdminEmail string
DisableSyncLock bool
DisableLoginForm bool DisableLoginForm bool
// Not documented & not supported // Not documented & not supported
// stand in until a more complete solution is implemented // stand in until a more complete solution is implemented
@ -1524,9 +1523,6 @@ func readAuthSettings(iniFile *ini.File, cfg *Cfg) (err error) {
cfg.TokenRotationIntervalMinutes = 2 cfg.TokenRotationIntervalMinutes = 2
} }
// Debug setting unlocking frontend auth sync lock. Users will still be reset on their next login.
cfg.DisableSyncLock = auth.Key("disable_sync_lock").MustBool(false)
// Do not use // Do not use
cfg.AuthConfigUIAdminAccess = auth.Key("config_ui_admin_access").MustBool(false) cfg.AuthConfigUIAdminAccess = auth.Key("config_ui_admin_access").MustBool(false)
cfg.AuthBrokerEnabled = auth.Key("broker").MustBool(true) cfg.AuthBrokerEnabled = auth.Key("broker").MustBool(true)

View File

@ -4,7 +4,6 @@ import { connect, ConnectedProps } from 'react-redux';
import { NavModelItem } from '@grafana/data'; import { NavModelItem } from '@grafana/data';
import { featureEnabled } from '@grafana/runtime'; import { featureEnabled } from '@grafana/runtime';
import { Page } from 'app/core/components/Page/Page'; import { Page } from 'app/core/components/Page/Page';
import config from 'app/core/config';
import { contextSrv } from 'app/core/core'; import { contextSrv } from 'app/core/core';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types'; import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types'; import { StoreState, UserDTO, UserOrg, UserSession, SyncInfo, UserAdminError, AccessControlAction } from 'app/types';
@ -106,7 +105,6 @@ export class UserAdminPage extends PureComponent<Props> {
const isLDAPUser = user?.isExternal && user?.authLabels?.includes('LDAP'); const isLDAPUser = user?.isExternal && user?.authLabels?.includes('LDAP');
const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList); const canReadSessions = contextSrv.hasPermission(AccessControlAction.UsersAuthTokenList);
const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead); const canReadLDAPStatus = contextSrv.hasPermission(AccessControlAction.LDAPStatusRead);
const isUserSynced = !config.auth.DisableSyncLock && user?.isExternallySynced;
const pageNav: NavModelItem = { const pageNav: NavModelItem = {
text: user?.login ?? '', text: user?.login ?? '',
@ -127,9 +125,13 @@ export class UserAdminPage extends PureComponent<Props> {
onUserEnable={this.onUserEnable} onUserEnable={this.onUserEnable}
onPasswordChange={this.onPasswordChange} onPasswordChange={this.onPasswordChange}
/> />
{isLDAPUser && isUserSynced && featureEnabled('ldapsync') && ldapSyncInfo && canReadLDAPStatus && ( {isLDAPUser &&
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} /> user?.isExternallySynced &&
)} featureEnabled('ldapsync') &&
ldapSyncInfo &&
canReadLDAPStatus && (
<UserLdapSyncInfo ldapSyncInfo={ldapSyncInfo} user={user} onUserSync={this.onUserSync} />
)}
<UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} /> <UserPermissions isGrafanaAdmin={user.isGrafanaAdmin} onGrafanaAdminChange={this.onGrafanaAdminChange} />
</> </>
)} )}
@ -138,7 +140,7 @@ export class UserAdminPage extends PureComponent<Props> {
<UserOrgs <UserOrgs
user={user} user={user}
orgs={orgs} orgs={orgs}
isExternalUser={isUserSynced} isExternalUser={user?.isExternallySynced}
onOrgRemove={this.onOrgRemove} onOrgRemove={this.onOrgRemove}
onOrgRoleChange={this.onOrgRoleChange} onOrgRoleChange={this.onOrgRoleChange}
onOrgAdd={this.onOrgAdd} onOrgAdd={this.onOrgAdd}