Skip to content

Commit

Permalink
feat(permissions): 🔥 Change rest of permission checks to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
Nudelsuppe42 committed Jun 2, 2024
1 parent 52f9f8b commit 26c4a4b
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/pages/admin/claims.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Button, Checkbox, Group, Paper, Progress, Title, Tooltip } from '@manti
import useSWR, { mutate } from 'swr';

import Page from '@/components/Page';
import { AdminSettingsTabs } from '@/components/SettingsTabs';
import { swrFetcher } from '@/components/SWRSetup';
import { AdminSettingsTabs } from '@/components/SettingsTabs';
import { useAccessToken } from '@/hooks/useAccessToken';
import thumbnail from '@/public/images/thumbnails/teams.png';
import { showNotification } from '@mantine/notifications';
Expand Down Expand Up @@ -123,7 +123,7 @@ const Settings = ({ data: tempData }: any) => {
image: thumbnail,
}}
seo={{ nofollow: true, noindex: true }}
requiredPermissions={['admin.admin']}
requiredPermissions={{ permissions: ['admin.admin'] }}
>
<AdminSettingsTabs>
{progress?.buildings && (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/cron.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Settings = ({ data: tempData }: any) => {
image: thumbnail,
}}
seo={{ nofollow: true, noindex: true }}
requiredPermissions={['admin.admin']}
requiredPermissions={{ permissions: ['admin.admin'] }}
loading={!data}
>
<AdminSettingsTabs loading={!data}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/admin/images/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const Settings = () => {
image: thumbnail,
}}
seo={{ nofollow: true, noindex: true }}
requiredPermissions={['team.claim.list']}
requiredPermissions={{ permissions: ['team.claim.list'] }}
>
<Table.ScrollContainer minWidth={800}>
<Table verticalSpacing="sm">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/calendar/manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Calendar: NextPage = () => {
image: thumbnail,
}}
seo={{ nofollow: true, noindex: true }}
requiredPermissions={['calendar.manage']}
requiredPermissions={{ permissions: ['calendar.manage'] }}
>
<form onSubmit={form.onSubmit(handleAdd)}>
<h2>Add Calendar Event</h2>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/faq/manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const Faq: NextPage = () => {
image: thumbnail,
}}
seo={{ nofollow: true, noindex: true }}
requiredPermissions={['faq.edit', 'faq.remove', 'faq.add']}
requiredPermissions={{ permissions: ['faq.edit', 'faq.remove', 'faq.add'] }}
loading={!data}
>
{!data ? (
Expand Down
19 changes: 10 additions & 9 deletions src/pages/me/claims/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import {
MenuItem,
MenuTarget,
NumberInput,
rem,
Select,
Switch,
Table,
Text,
Textarea,
TextInput,
Textarea,
Tooltip,
rem,
} from '@mantine/core';
import { useClipboard, useDebouncedState } from '@mantine/hooks';
import {
Expand All @@ -34,23 +34,24 @@ import {
} from '@tabler/icons-react';
import { useEffect, useState } from 'react';

import Page from '@/components/Page';
import { ClaimDrawerImages } from '@/components/map/ClaimDrawerImages';
import Map from '@/components/map/Map';
import { Discord } from '@icons-pack/react-simple-icons';
import MapboxDraw from '@mapbox/mapbox-gl-draw';
import { NextPage } from 'next';
import Link from 'next/link';
/* eslint-disable react-hooks/exhaustive-deps */
import Page from '@/components/Page';
import { useAccessToken } from '@/hooks/useAccessToken';
import { useUser } from '@/hooks/useUser';
import thumbnail from '@/public/images/thumbnails/me.png';
import fetcher from '@/utils/Fetcher';
import { Discord } from '@icons-pack/react-simple-icons';
import { showNotification } from '@mantine/notifications';
import MapboxDraw from '@mapbox/mapbox-gl-draw';
import { NextPage } from 'next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useTranslation } from 'react-i18next';

/* eslint-disable react-hooks/exhaustive-deps */

const ClaimPage: NextPage = ({ claimId, data }: any) => {
const [polygon, setPolygon] = useState<any>({
type: 'Feature',
Expand Down Expand Up @@ -192,7 +193,7 @@ const ClaimPage: NextPage = ({ claimId, data }: any) => {
image: thumbnail,
}}
smallPadding
requiredPermissions={['account.edit', 'account.info']}
requiredPermissions={{ permissions: ['account.edit', 'account.info'] }}
loading={!data}
>
{!data ? (
Expand Down
4 changes: 2 additions & 2 deletions src/pages/me/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
Code,
Grid,
Group,
rem,
Stack,
Text,
Tooltip,
rem,
useMantineColorScheme,
useMantineTheme,
} from '@mantine/core';
Expand Down Expand Up @@ -48,7 +48,7 @@ const MePage: NextPage = () => {
title: t('head.title'),
image: thumbnail,
}}
requiredPermissions={['account.info']}
requiredPermissions={{ permissions: ['account.info'] }}
loading={!data}
>
{data && (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/me/review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ReviewPage: NextPage = () => {
title: 'Review Applications',
image: thumbnail,
}}
requiredPermissions={['account.info']}
requiredPermissions={{ permissions: ['account.info'] }}
loading={!data}
>
<Table.ScrollContainer minWidth={800}>
Expand Down
7 changes: 4 additions & 3 deletions src/pages/me/settings/[type].tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Alert, Badge, Button, Card, Flex, Group, rem, Tabs, Text, TextInput } from '@mantine/core';
/* eslint-disable react-hooks/exhaustive-deps */
import { Discord, Github } from '@icons-pack/react-simple-icons';
import { Alert, Badge, Button, Card, Flex, Group, rem, Tabs, Text, TextInput } from '@mantine/core';
import {
IconAlertCircle,
IconBroadcast,
Expand Down Expand Up @@ -28,6 +27,8 @@ import { useRouter } from 'next/router';
import { useTranslation } from 'react-i18next';
import useSWR from 'swr';

/* eslint-disable react-hooks/exhaustive-deps */

const Settings: NextPage = ({ type }: any) => {
const user = useUser();
const { accessToken } = useAccessToken();
Expand Down Expand Up @@ -93,7 +94,7 @@ const Settings: NextPage = ({ type }: any) => {
title: 'Account Settings',
image: thumbnail,
}}
requiredPermissions={['account.edit', 'account.info']}
requiredPermissions={{ permissions: ['account.edit', 'account.info'] }}
loading={!data}
>
{data && (
Expand Down

0 comments on commit 26c4a4b

Please sign in to comment.