Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 1467ca1

Browse files
committed
add: application no permissions check
1 parent 7c9dc73 commit 1467ca1

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

  • apps/admin-ui/src/spa/applications/[id]

apps/admin-ui/src/spa/applications/[id]/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,7 @@ function ApplicationDetails({
824824
data,
825825
loading: isLoading,
826826
refetch,
827+
error,
827828
} = useQuery<Query, QueryApplicationArgs>(APPLICATION_ADMIN_QUERY, {
828829
skip: applicationPk === 0,
829830
variables: { id },
@@ -839,6 +840,17 @@ function ApplicationDetails({
839840
return <Loader />;
840841
}
841842

843+
if (error) {
844+
return <div>{t("errors.errorFetchingApplication")}</div>;
845+
}
846+
847+
// NOTE id query will return null if the application is not found or the user does not have permission
848+
// we can't distinguish between these two cases
849+
const canView = application != null;
850+
if (!canView) {
851+
return <div>{t("errors.noPermission")}</div>;
852+
}
853+
842854
const isOrganisation = application?.organisation != null;
843855

844856
// TODO replace this with an explicit check and warn on undefined fields

0 commit comments

Comments
 (0)