Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefwint committed Jan 30, 2024
2 parents 131bd60 + 919ea10 commit 5482382
Show file tree
Hide file tree
Showing 6 changed files with 599 additions and 608 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"type": "module",
"dependencies": {
"@headlessui/react": "^1.7.17",
"@pzh-ui/components": "^0.0.461",
"@pzh-ui/components": "^0.0.463",
"@pzh-ui/config": "^0.0.56",
"@pzh-ui/css": "^0.0.79",
"@pzh-ui/icons": "^0.0.48",
"@pzh-ui/icons": "^0.0.50",
"@react-hookz/web": "^24.0.2",
"@tanstack/react-query": "^5.14.2",
"axios": "^1.6.2",
Expand Down
2 changes: 1 addition & 1 deletion public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */

/**
* Mock Service Worker (2.1.1).
* Mock Service Worker (2.1.5).
* @see https://github.com/mswjs/msw
* - Please do NOT modify this file.
* - Please do NOT serve this file on production.
Expand Down
6 changes: 3 additions & 3 deletions src/App/Routes/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ const AppRoutes = () => {
element: (
<ProtectedRoute
permissions={{
canCreateUser: true,
canCreatePublicationTemplates: true,
}}
redirectTo="/muteer">
<PublicationTemplateOverview />
Expand All @@ -405,7 +405,7 @@ const AppRoutes = () => {
element: (
<ProtectedRoute
permissions={{
canCreateUser: true,
canCreatePublicationTemplates: true,
}}
redirectTo="/muteer">
<PublicationTemplateEdit />
Expand All @@ -417,7 +417,7 @@ const AppRoutes = () => {
element: (
<ProtectedRoute
permissions={{
canCreateUser: true,
canCreatePublicationTemplates: true,
}}
redirectTo="/muteer">
<PublicationTemplateCreate />
Expand Down
15 changes: 13 additions & 2 deletions src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text } from '@pzh-ui/components'
import { House, Users } from '@pzh-ui/icons'
import { FileInvoice, House, Users } from '@pzh-ui/icons'
import classNames from 'classnames'
import { useState } from 'react'
import { Link } from 'react-router-dom'
Expand All @@ -9,7 +9,7 @@ import { ModelType } from '@/config/objects/types'
import usePermissions from '@/hooks/usePermissions'

const Sidebar = () => {
const { canEditUser } = usePermissions()
const { canEditUser, canCreatePublicationTemplates } = usePermissions()

const [expanded, setExpanded] = useState(false)

Expand Down Expand Up @@ -91,6 +91,17 @@ const Sidebar = () => {
/>
</>
)}

{canCreatePublicationTemplates && (
<MenuItem
name="Publicatietemplates"
path="/muteer/publicatietemplates"
icon={FileInvoice}
expanded={expanded}
onHover={endAndStartTimer}
onClick={() => window.clearTimeout(timer)}
/>
)}
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/usePermissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Permissions {
canCreateUser: boolean
canEditUser: boolean
canResetUserPassword: boolean
canCreatePublicationTemplates: boolean
}

const usePermissions = (): Permissions => {
Expand All @@ -29,6 +30,7 @@ const usePermissions = (): Permissions => {
canCreateUser: false,
canEditUser: false,
canResetUserPassword: false,
canCreatePublicationTemplates: false,
}

switch (role) {
Expand All @@ -51,6 +53,7 @@ const usePermissions = (): Permissions => {
canCreateUser: true,
canEditUser: true,
canResetUserPassword: true,
canCreatePublicationTemplates: true,
}
case 'Behandelend Ambtenaar':
return {
Expand Down
Loading

0 comments on commit 5482382

Please sign in to comment.