diff --git a/src/common/hooks/campaigns.ts b/src/common/hooks/campaigns.ts index 6ac33e2ad..8bc46ace8 100644 --- a/src/common/hooks/campaigns.ts +++ b/src/common/hooks/campaigns.ts @@ -13,6 +13,7 @@ import { import { DonationStatus } from 'gql/donations.enums' import { apiClient } from 'service/apiClient' import { useCurrentPerson } from 'common/util/useCurrentPerson' +import { isAdmin } from 'common/util/roles' // NOTE: shuffling the campaigns so that each gets its fair chance to be on top row export const campaignsOrderQueryFunction: QueryFunction = async ({ @@ -128,7 +129,8 @@ export function useCanEditCampaign(slug: string) { const canEdit = userData.user.id === campaignData.campaign.organizer?.person.id || - session?.user?.realm_access?.roles?.includes('podkrepi-admin') + session?.user?.realm_access?.roles?.includes('podkrepi-admin') || + isAdmin(session) return canEdit } diff --git a/src/components/client/campaign-expenses/Form.tsx b/src/components/client/campaign-expenses/Form.tsx index db827bc10..4fd451928 100644 --- a/src/components/client/campaign-expenses/Form.tsx +++ b/src/components/client/campaign-expenses/Form.tsx @@ -37,6 +37,7 @@ import { downloadCampaignExpenseFile, deleteExpenseFile } from 'service/expense' import { useSession } from 'next-auth/react' import DeleteForeverIcon from '@mui/icons-material/DeleteForever' import { useViewPersonByKeylockId } from 'common/hooks/person' +import { isAdmin } from 'common/util/roles' const validTypes = Object.keys(ExpenseType) const validStatuses = Object.keys(ExpenseStatus) @@ -53,7 +54,8 @@ export default function Form() { const { data: expenseFiles } = useCampaignExpenseFiles(id) const { data: session } = useSession() - const canApprove = !!session?.user?.realm_access?.roles?.includes('podkrepi-admin') + const canApprove = + !!session?.user?.realm_access?.roles?.includes('podkrepi-admin') || isAdmin(session) const { data: person } = useViewPersonByKeylockId(session?.user?.sub as string)