import { translate } from '../../helpers/l10n';
import { isPermissionDefinitionGroup } from '../../helpers/permissions';
import { getBaseUrl } from '../../helpers/system';
-import { useIdentityProviderQuery } from '../../queries/identity-provider/common';
import { Permissions } from '../../types/permissions';
-import { PermissionDefinitions, PermissionGroup, Provider } from '../../types/types';
+import { PermissionDefinitions, PermissionGroup } from '../../types/types';
import GroupIcon from '../icons/GroupIcon';
import PermissionCell from './PermissionCell';
import usePermissionChange from './usePermissionChange';
selectedPermission?: string;
disabled?: boolean;
removeOnly?: boolean;
- isGitHubProject?: boolean;
}
export const ANYONE = 'Anyone';
export default function GroupHolder(props: Props) {
- const {
- group,
- isComponentPrivate,
- permissions,
- selectedPermission,
- disabled,
- removeOnly,
- isGitHubProject,
- } = props;
+ const { group, isComponentPrivate, permissions, selectedPermission, disabled, removeOnly } =
+ props;
const { loading, handleCheck, modal } = usePermissionChange({
holder: group,
onToggle: props.onToggle,
permissions,
removeOnly,
});
- const { data: identityProvider } = useIdentityProviderQuery({
- enabled: isGitHubProject ?? false,
- });
const description =
group.name === ANYONE ? translate('user_groups.anyone.description') : group.description;
<div className="sw-flex-1 sw-text-ellipsis sw-whitespace-nowrap sw-overflow-hidden sw-min-w-0">
<strong>{group.name}</strong>
</div>
- {isGitHubProject &&
- identityProvider?.provider === Provider.Github &&
- group.managed && (
- <img
- alt="github"
- className="sw-ml-2"
- aria-label={translate('project_permission.github_managed')}
- height={16}
- src={`${getBaseUrl()}/images/alm/github.svg`}
- />
- )}
+ {disabled && (
+ <img
+ alt="github"
+ className="sw-ml-2"
+ aria-label={translate('project_permission.github_managed')}
+ height={16}
+ src={`${getBaseUrl()}/images/alm/github.svg`}
+ />
+ )}
{group.name === ANYONE && (
<Badge className="sw-ml-2" variant="deleted">
{translate('deprecated')}
user={item}
disabled={isGitHubProject && !!githubProvisioningStatus && item.managed}
removeOnly={isGitHubProject && !!githubProvisioningStatus && !item.managed}
- isGitHubProject={isGitHubProject}
/>
) : (
<GroupHolder
selectedPermission={selectedPermission}
disabled={isGitHubProject && !!githubProvisioningStatus && item.managed}
removeOnly={isGitHubProject && !!githubProvisioningStatus && !item.managed}
- isGitHubProject={isGitHubProject}
/>
)}
</>
import { translate } from '../../helpers/l10n';
import { isPermissionDefinitionGroup } from '../../helpers/permissions';
import { getBaseUrl } from '../../helpers/system';
-import { useIdentityProviderQuery } from '../../queries/identity-provider/common';
-import { PermissionDefinitions, PermissionUser, Provider } from '../../types/types';
+import { PermissionDefinitions, PermissionUser } from '../../types/types';
import PermissionCell from './PermissionCell';
import usePermissionChange from './usePermissionChange';
permissions: PermissionDefinitions;
selectedPermission?: string;
user: PermissionUser;
- isGitHubProject?: boolean;
disabled?: boolean;
removeOnly?: boolean;
}
export default function UserHolder(props: Props) {
- const { user, disabled, removeOnly, permissions, isGitHubProject, selectedPermission } = props;
+ const { user, disabled, removeOnly, permissions, selectedPermission } = props;
const { loading, handleCheck, modal } = usePermissionChange({
holder: user,
onToggle: props.onToggle,
permissions,
removeOnly,
});
- const { data: identityProvider } = useIdentityProviderQuery({
- enabled: isGitHubProject ?? false,
- });
const permissionCells = permissions.map((permission) => (
<PermissionCell
<strong>{user.name}</strong>
<Note className="sw-ml-2">{user.login}</Note>
</div>
- {isGitHubProject &&
- identityProvider?.provider === Provider.Github &&
- user.managed && (
- <img
- alt="github"
- className="sw-ml-2"
- height={16}
- aria-label={translate('project_permission.github_managed')}
- src={`${getBaseUrl()}/images/alm/github.svg`}
- />
- )}
+ {disabled && (
+ <img
+ alt="github"
+ className="sw-ml-2"
+ height={16}
+ aria-label={translate('project_permission.github_managed')}
+ src={`${getBaseUrl()}/images/alm/github.svg`}
+ />
+ )}
</div>
{user.email && (
<div className="sw-mt-2 sw-max-w-100 sw-text-ellipsis sw-whitespace-nowrap sw-overflow-hidden">