aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components/permissions/UserHolder.tsx
diff options
context:
space:
mode:
authorguillaume-peoch-sonarsource <guillaume.peoch@sonarsource.com>2024-08-13 15:36:20 +0200
committersonartech <sonartech@sonarsource.com>2024-08-19 20:02:45 +0000
commit06834faf485721e8674b830c46a229441ed70623 (patch)
treeea0ee2ebf6383bf611c1b69154bb79522708735e /server/sonar-web/src/main/js/components/permissions/UserHolder.tsx
parent5c6dd397bcb5579cf1f9ceaa71de391c4fe3e36c (diff)
downloadsonarqube-06834faf485721e8674b830c46a229441ed70623.tar.gz
sonarqube-06834faf485721e8674b830c46a229441ed70623.zip
SONAR-22559 Make permissions read-only for GitLab projects
Diffstat (limited to 'server/sonar-web/src/main/js/components/permissions/UserHolder.tsx')
-rw-r--r--server/sonar-web/src/main/js/components/permissions/UserHolder.tsx28
1 files changed, 22 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/components/permissions/UserHolder.tsx b/server/sonar-web/src/main/js/components/permissions/UserHolder.tsx
index b0088590290..a3f2133775a 100644
--- a/server/sonar-web/src/main/js/components/permissions/UserHolder.tsx
+++ b/server/sonar-web/src/main/js/components/permissions/UserHolder.tsx
@@ -21,7 +21,7 @@
import { Avatar, ContentCell, Note, TableRowInteractive } from 'design-system';
import * as React from 'react';
import { Image } from '~sonar-aligned/components/common/Image';
-import { translate } from '../../helpers/l10n';
+import { translate, translateWithParameters } from '../../helpers/l10n';
import { isPermissionDefinitionGroup } from '../../helpers/permissions';
import { isDefined } from '../../helpers/types';
import { PermissionDefinitions, PermissionUser } from '../../types/types';
@@ -29,7 +29,8 @@ import PermissionCell from './PermissionCell';
import usePermissionChange from './usePermissionChange';
interface Props {
- disabled?: boolean;
+ isGitHubUser: boolean | undefined;
+ isGitLabUser: boolean | undefined;
onToggle: (user: PermissionUser, permission: string) => Promise<void>;
permissions: PermissionDefinitions;
removeOnly?: boolean;
@@ -38,7 +39,7 @@ interface Props {
}
export default function UserHolder(props: Props) {
- const { user, disabled, removeOnly, permissions, selectedPermission } = props;
+ const { user, removeOnly, permissions, selectedPermission, isGitHubUser, isGitLabUser } = props;
const { loading, handleCheck, modal } = usePermissionChange({
holder: user,
onToggle: props.onToggle,
@@ -52,7 +53,7 @@ export default function UserHolder(props: Props) {
loading={loading}
onCheck={handleCheck}
permission={permission}
- disabled={disabled}
+ disabled={isGitHubUser || isGitLabUser}
removeOnly={removeOnly}
permissionItem={user}
prefixID={user.login}
@@ -91,15 +92,30 @@ export default function UserHolder(props: Props) {
<strong>{user.name}</strong>
<Note className="sw-ml-2">{user.login}</Note>
</div>
- {disabled && (
+ {isGitHubUser && (
<Image
alt="github"
className="sw-ml-2"
height={16}
- aria-label={translate('project_permission.github_managed')}
+ aria-label={translateWithParameters(
+ 'project_permission.managed',
+ translate('alm.github'),
+ )}
src="/images/alm/github.svg"
/>
)}
+ {isGitLabUser && (
+ <Image
+ alt="gitlab"
+ className="sw-ml-2"
+ height={16}
+ aria-label={translateWithParameters(
+ 'project_permission.managed',
+ translate('alm.gitlab'),
+ )}
+ src="/images/alm/gitlab.svg"
+ />
+ )}
</div>
{isDefined(user.email) && (
<div className="sw-mt-2 sw-max-w-100 sw-text-ellipsis sw-whitespace-nowrap sw-overflow-hidden">