mirror of
https://github.com/docmost/docmost.git
synced 2026-05-18 07:24:04 +08:00
feat: give workspace owners global space management permission
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@ export interface QueryParams {
|
||||
query?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
includeAllSpaces?: boolean;
|
||||
}
|
||||
|
||||
export enum UserRole {
|
||||
|
||||
Reference in New Issue
Block a user