more finegrain permissions
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Publisher } from "@prisma/client"
|
import { Publisher, UserRole } from "@prisma/client"
|
||||||
// import {IsDateXMonthsAgo} from "../../helpers/const"
|
// import {IsDateXMonthsAgo} from "../../helpers/const"
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
@ -97,6 +97,7 @@ export default function PublisherCard({ publisher }) {
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div className="absolute bottom-2 right-2">
|
<div className="absolute bottom-2 right-2">
|
||||||
|
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage=" ">
|
||||||
<button onClick={() => { setIsModalOpen(true) }} aria-label="Изтрий Publisher">
|
<button onClick={() => { setIsModalOpen(true) }} aria-label="Изтрий Publisher">
|
||||||
<svg className="w-5 h-6 text-red-500 hover:text-red-700" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
<svg className="w-5 h-6 text-red-500 hover:text-red-700" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
||||||
<path d="M10 11V17" stroke="#000000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
<path d="M10 11V17" stroke="#000000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
|
||||||
@ -115,8 +116,8 @@ export default function PublisherCard({ publisher }) {
|
|||||||
onConfirm={() => handleDelete(publisher.id)}
|
onConfirm={() => handleDelete(publisher.id)}
|
||||||
message="Сигурни ли сте, че искате да изтриете този профил? Това действие не може да бъде отменено."
|
message="Сигурни ли сте, че искате да изтриете този профил? Това действие не може да бъде отменено."
|
||||||
/>
|
/>
|
||||||
<ProtectedRoute>
|
</ProtectedRoute>
|
||||||
|
<ProtectedRoute allowedRoles={[UserRole.ADMIN, UserRole.POWERUSER]} deniedMessage=" ">
|
||||||
<button onClick={() => handleLoginAs(publisher.id)}>Login as</button>
|
<button onClick={() => handleLoginAs(publisher.id)}>Login as</button>
|
||||||
</ProtectedRoute>
|
</ProtectedRoute>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user