Skip to content

Commit 38e14a6

Browse files
authored
Allow delete groups issued by jwt (#487)
1 parent b79c661 commit 38e14a6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/modules/settings/GroupsActionCell.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import FullTooltip from "@components/FullTooltip";
33
import { notify } from "@components/Notification";
44
import { useApiCall } from "@utils/api";
55
import { Trash2 } from "lucide-react";
6-
import React from "react";
6+
import React, { useMemo } from "react";
77
import { useSWRConfig } from "swr";
88
import { useDialog } from "@/contexts/DialogProvider";
99
import { usePermissions } from "@/contexts/PermissionsProvider";
@@ -50,7 +50,12 @@ export default function GroupsActionCell({ group, in_use }: Readonly<Props>) {
5050
issued: group?.issued,
5151
});
5252

53-
const isDisabled = in_use || !isRegularGroup || !permission.groups.delete;
53+
const isDisabled = useMemo(() => {
54+
if (!permission.groups.delete) return true;
55+
if (in_use) return true;
56+
if (isJWTGroup) return false;
57+
return !isRegularGroup;
58+
}, [permission, in_use, isJWTGroup, isRegularGroup]);
5459

5560
const getDisabledText = () => {
5661
if (isRegularGroup) {

0 commit comments

Comments
 (0)