Skip to content

Commit f049a1b

Browse files
committed
fix: skip checks if no FLP
1 parent 029d175 commit f049a1b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/app-aco/src/contexts/folders.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { AcoAppContext } from "~/contexts/app";
55
import { useFoldersApi } from "~/hooks";
66
import { ROOT_FOLDER } from "~/constants";
77
import { useSecurity } from "@webiny/app-security";
8+
import { useWcp } from "@webiny/app-wcp/hooks/useWcp";
89

910
interface FoldersContext {
1011
folders?: FolderItem[] | null;
@@ -50,6 +51,7 @@ export const FoldersProvider: React.VFC<Props> = ({ children, ...props }) => {
5051
const [loading, setLoading] = useState<Loading<LoadingActions>>(defaultLoading);
5152
const foldersApi = useFoldersApi();
5253
const { getPermission } = useSecurity();
54+
const { canUseFolderLevelPermissions } = useWcp();
5355

5456
const app = appContext ? appContext.app : undefined;
5557

@@ -137,6 +139,11 @@ export const FoldersProvider: React.VFC<Props> = ({ children, ...props }) => {
137139
},
138140

139141
canManageFolderStructure(id) {
142+
// If FLP is not enabled, all users can manage folder structure.
143+
if (!canUseFolderLevelPermissions()) {
144+
return true;
145+
}
146+
140147
if (id !== ROOT_FOLDER) {
141148
const folder = folders?.find(folder => folder.id === id);
142149
return !!folder?.canManageStructure;

0 commit comments

Comments
 (0)