Explorar el Código

adding auth

master
padre
commit
6bf874bda8
Se han modificado 3 ficheros con 12 adiciones y 6 borrados
  1. +9
    -2
      src/authorities.ts
  2. +1
    -1
      src/components/DetailedSchedule/DetailedScheduleSearchView.tsx
  3. +2
    -3
      src/components/NavigationContent/NavigationContent.tsx

+ 9
- 2
src/authorities.ts Ver fichero

@@ -1,7 +1,14 @@
export const [VIEW_USER, VIEW_DO, MAINTAIN_USER, VIEW_GROUP, MAINTAIN_GROUP] = [
export const [VIEW_USER,MAINTAIN_USER, VIEW_GROUP, MAINTAIN_GROUP,
TESTING, PROD, PACK, ADMIN, STOCK, Driver] = [
"VIEW_USER",
"VIEW_DO",
"MAINTAIN_USER",
"VIEW_GROUP",
"MAINTAIN_GROUP",
//below auth act as role
"TESTING",
"PROD",
"PACK",
"ADMIN",
"STOCK",
"Driver",
];

+ 1
- 1
src/components/DetailedSchedule/DetailedScheduleSearchView.tsx Ver fichero

@@ -26,7 +26,7 @@ import isToday from 'dayjs/plugin/isToday';
import useUploadContext from "../UploadProvider/useUploadContext";
import { FileDownload, CalendarMonth } from "@mui/icons-material";
import { useSession } from "next-auth/react";
import { VIEW_USER, VIEW_DO } from "@/authorities";
import { VIEW_USER } from "@/authorities";

dayjs.extend(isToday);



+ 2
- 3
src/components/NavigationContent/NavigationContent.tsx Ver fichero

@@ -28,12 +28,11 @@ import Logo from "../Logo";
import BugReportIcon from "@mui/icons-material/BugReport";
import {
VIEW_USER,
VIEW_DO,
MAINTAIN_USER,
VIEW_GROUP,
MAINTAIN_GROUP,
// Add more authorities as needed, e.g.:
// VIEW_PO, MAINTAIN_PO, VIEW_INVENTORY, etc.
TESTING, PROD, PACK, ADMIN, STOCK, Driver
} from "../../authorities";

interface NavigationItem {
@@ -137,7 +136,6 @@ const NavigationContent: React.FC = () => {
label: "Delivery",
path: "",
//requiredAbility: VIEW_DO,
requiredAbility: VIEW_USER,
children: [
{
icon: <RequestQuote />,
@@ -235,6 +233,7 @@ const NavigationContent: React.FC = () => {
icon: <BugReportIcon />,
label: "Printer Testing",
path: "/testing",
requiredAbility: TESTING,
isHidden: false,
},
{


Cargando…
Cancelar
Guardar