feat: give workspace owners global space management permission

This commit is contained in:
Philipinho
2025-09-19 22:00:09 +01:00
parent 3c4cab0d2a
commit 3b4a02e94a
9 changed files with 130 additions and 14 deletions
@@ -8,11 +8,20 @@ import { useTranslation } from "react-i18next";
import Paginate from "@/components/common/paginate.tsx";
import { CustomAvatar } from "@/components/ui/custom-avatar.tsx";
import { AvatarIconType } from "@/features/attachments/types/attachment.types.ts";
import { useAtom } from "jotai";
import { userAtom } from "@/features/user/atoms/current-user-atom.ts";
import { UserRole } from "@/lib/types.ts";
import { useIsEEOnly } from "@/hooks/use-is-cloud-ee.tsx";
export default function SpaceList() {
const { t } = useTranslation();
const [page, setPage] = useState(1);
const { data, isLoading } = useGetSpacesQuery({ page });
const [user] = useAtom(userAtom);
const isEEOnly = useIsEEOnly();
const { data, isLoading } = useGetSpacesQuery({
page,
...(isEEOnly && user.role === UserRole.OWNER && { includeAllSpaces: true }),
});
const [opened, { open, close }] = useDisclosure(false);
const [selectedSpaceId, setSelectedSpaceId] = useState<string>(null);
+10 -1
View File
@@ -1,7 +1,16 @@
import { isCloud } from "@/lib/config";
import { useLicense } from "@/ee/hooks/use-license";
import { useAtom } from "jotai/index";
import { currentUserAtom } from "@/features/user/atoms/current-user-atom.ts";
import usePlan from "@/ee/hooks/use-plan";
export const useIsCloudEE = () => {
const { hasLicenseKey } = useLicense();
return isCloud() || !!hasLicenseKey;
};
};
export const useIsEEOnly = () => {
const { hasLicenseKey } = useLicense();
const { isBusiness } = usePlan();
return (isCloud() && isBusiness) || !!hasLicenseKey;
};
+1
View File
@@ -2,6 +2,7 @@ export interface QueryParams {
query?: string;
page?: number;
limit?: number;
includeAllSpaces?: boolean;
}
export enum UserRole {