mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Auth: Add skip_org_role_sync to GitLab OAuth (#62055)
* Auth: Add skip_org_role_sync to GitLab OAuth - add: tests - docs added * Update pkg/login/social/gitlab_oauth.go Co-authored-by: Karl Persson <kalle.persson@grafana.com> * fix: for import Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
@@ -39,7 +39,7 @@ interface OwnProps extends GrafanaRouteComponentProps<{ id: string }> {
|
||||
error?: UserAdminError;
|
||||
}
|
||||
|
||||
const SyncedOAuthLabels: string[] = ['GitHub', 'GitLab', 'OAuth'];
|
||||
const SyncedOAuthLabels: string[] = ['GitHub', 'OAuth'];
|
||||
|
||||
export class UserAdminPage extends PureComponent<Props> {
|
||||
async componentDidMount() {
|
||||
@@ -113,6 +113,7 @@ export class UserAdminPage extends PureComponent<Props> {
|
||||
user?.isExternal && user?.authLabels?.some((r) => SyncedOAuthLabels.includes(r));
|
||||
const isSAMLUser = user?.isExternal && user?.authLabels?.includes('SAML');
|
||||
const isGoogleUser = user?.isExternal && user?.authLabels?.includes('Google');
|
||||
const isGitLabUser = user?.isExternal && user?.authLabels?.includes('GitLab');
|
||||
const isAuthProxyUser = user?.isExternal && user?.authLabels?.includes('Auth Proxy');
|
||||
const isAzureADUser = user?.isExternal && user?.authLabels?.includes('AzureAD');
|
||||
const isGrafanaComUser = user?.isExternal && user?.authLabels?.includes('grafana.com');
|
||||
@@ -122,6 +123,7 @@ export class UserAdminPage extends PureComponent<Props> {
|
||||
!(
|
||||
isAuthProxyUser ||
|
||||
isGoogleUser ||
|
||||
isGitLabUser ||
|
||||
isOAuthUserWithSkippableSync ||
|
||||
isSAMLUser ||
|
||||
isLDAPUser ||
|
||||
@@ -136,6 +138,7 @@ export class UserAdminPage extends PureComponent<Props> {
|
||||
// both OAuthSkipOrgRoleUpdateSync and specific provider settings needs to be false for a user to be synced
|
||||
(!config.auth.OAuthSkipOrgRoleUpdateSync && !config.auth.GrafanaComSkipOrgRoleSync && isGrafanaComUser) ||
|
||||
(!config.auth.OAuthSkipOrgRoleUpdateSync && !config.auth.AzureADSkipOrgRoleSync && isAzureADUser) ||
|
||||
(!config.auth.OAuthSkipOrgRoleUpdateSync && !config.auth.GitLabSkipOrgRoleSync && isGitLabUser) ||
|
||||
(!config.auth.OAuthSkipOrgRoleUpdateSync && !config.auth.GoogleSkipOrgRoleSync && isGoogleUser));
|
||||
|
||||
const pageNav: NavModelItem = {
|
||||
|
||||
Reference in New Issue
Block a user