Groups should be clickable when user has view-access on the group (#26033)

Closes #26040

Signed-off-by: Peter Keuter <github@peterkeuter.nl>
This commit is contained in:
Peter Keuter 2024-01-24 10:17:39 +01:00 committed by GitHub
parent a0bcf35236
commit 21bdea3b71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 13 deletions

View file

@ -22,13 +22,9 @@ import { adminClient } from "../admin-client";
type GroupTableProps = { type GroupTableProps = {
refresh: () => void; refresh: () => void;
canViewDetails: boolean;
}; };
export const GroupTable = ({ export const GroupTable = ({ refresh: viewRefresh }: GroupTableProps) => {
refresh: viewRefresh,
canViewDetails,
}: GroupTableProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [selectedRows, setSelectedRows] = useState<GroupRepresentation[]>([]); const [selectedRows, setSelectedRows] = useState<GroupRepresentation[]>([]);
@ -192,7 +188,7 @@ export const GroupTable = ({
name: "name", name: "name",
displayKey: "groupName", displayKey: "groupName",
cellRenderer: (group) => cellRenderer: (group) =>
canViewDetails ? ( group.access?.view ? (
<Link key={group.id} to={`${location.pathname}/${group.id}`}> <Link key={group.id} to={`${location.pathname}/${group.id}`}>
{group.name} {group.name}
</Link> </Link>

View file

@ -197,10 +197,7 @@ export default function GroupsSection() {
eventKey={0} eventKey={0}
title={<TabTitleText>{t("childGroups")}</TabTitleText>} title={<TabTitleText>{t("childGroups")}</TabTitleText>}
> >
<GroupTable <GroupTable refresh={refresh} />
refresh={refresh}
canViewDetails={canViewDetails}
/>
</Tab> </Tab>
{canViewMembers && ( {canViewMembers && (
<Tab <Tab
@ -238,9 +235,7 @@ export default function GroupsSection() {
)} )}
</Tabs> </Tabs>
)} )}
{subGroups.length === 0 && ( {subGroups.length === 0 && <GroupTable refresh={refresh} />}
<GroupTable refresh={refresh} canViewDetails={canViewDetails} />
)}
</DrawerContentBody> </DrawerContentBody>
</DrawerContent> </DrawerContent>
</Drawer> </Drawer>