diff --git a/src/helpers/permissions.ts b/src/helpers/permissions.ts
new file mode 100644
index 0000000..be8fcd2
--- /dev/null
+++ b/src/helpers/permissions.ts
@@ -0,0 +1,59 @@
+import type { PermissionType } from '@/pages/roles/types/Types';
+
+/**
+ * Checks if user has a specific permission
+ * @param permissions - Array of user permissions
+ * @param permissionName - Name of the permission to check
+ * @returns boolean indicating if user has the permission
+ */
+export const hasPermission = (
+ permissions: PermissionType[] | undefined,
+ permissionName: string
+): boolean => {
+ if (!permissions || permissions.length === 0) {
+ return false;
+ }
+
+ return permissions.some(
+ (permission) => permission.name === permissionName
+ );
+};
+
+/**
+ * Checks if user has any of the specified permissions
+ * @param permissions - Array of user permissions
+ * @param permissionNames - Array of permission names to check
+ * @returns boolean indicating if user has at least one of the permissions
+ */
+export const hasAnyPermission = (
+ permissions: PermissionType[] | undefined,
+ permissionNames: string[]
+): boolean => {
+ if (!permissions || permissions.length === 0 || permissionNames.length === 0) {
+ return false;
+ }
+
+ return permissionNames.some((permissionName) =>
+ hasPermission(permissions, permissionName)
+ );
+};
+
+/**
+ * Checks if user has all of the specified permissions
+ * @param permissions - Array of user permissions
+ * @param permissionNames - Array of permission names to check
+ * @returns boolean indicating if user has all of the permissions
+ */
+export const hasAllPermissions = (
+ permissions: PermissionType[] | undefined,
+ permissionNames: string[]
+): boolean => {
+ if (!permissions || permissions.length === 0 || permissionNames.length === 0) {
+ return false;
+ }
+
+ return permissionNames.every((permissionName) =>
+ hasPermission(permissions, permissionName)
+ );
+};
+
diff --git a/src/hooks/usePermissions.ts b/src/hooks/usePermissions.ts
new file mode 100644
index 0000000..bd13ab6
--- /dev/null
+++ b/src/hooks/usePermissions.ts
@@ -0,0 +1,50 @@
+import { useMemo } from "react";
+import { useGetPermissions } from "@/pages/roles/hooks/useRolesData";
+import {
+ hasPermission,
+ hasAnyPermission,
+ hasAllPermissions,
+} from "@/helpers/permissions";
+
+/**
+ * Custom hook for managing user permissions
+ * @returns Object with permissions data and helper functions
+ */
+export const usePermissions = () => {
+ const { data: permissionsResponse, isLoading, error } = useGetPermissions();
+
+ const permissions = useMemo(() => {
+ return permissionsResponse?.data || [];
+ }, [permissionsResponse]);
+
+ /**
+ * Checks if user has a specific permission
+ */
+ const checkPermission = (permissionName: string): boolean => {
+ return hasPermission(permissions, permissionName);
+ };
+
+ /**
+ * Checks if user has any of the specified permissions
+ */
+ const checkAnyPermission = (permissionNames: string[]): boolean => {
+ return hasAnyPermission(permissions, permissionNames);
+ };
+
+ /**
+ * Checks if user has all of the specified permissions
+ */
+ const checkAllPermissions = (permissionNames: string[]): boolean => {
+ return hasAllPermissions(permissions, permissionNames);
+ };
+
+ return {
+ permissions,
+ isLoading,
+ error,
+ checkPermission,
+ checkAnyPermission,
+ checkAllPermissions,
+ hasPermission: checkPermission,
+ };
+};
diff --git a/src/pages/roles/enum/Enum.ts b/src/pages/roles/enum/Enum.ts
new file mode 100644
index 0000000..d9f0073
--- /dev/null
+++ b/src/pages/roles/enum/Enum.ts
@@ -0,0 +1,29 @@
+export const enum PermissionEnum {
+ MANAGE_PAGER = "manage_pager",
+ // Food Management
+ MANAGE_FOODS = "manage_foods",
+ MANAGE_CATEGORIES = "manage_categories",
+
+ // Order Management
+ MANAGE_ORDERS = "manage_orders",
+
+ // User & Admin Management
+ MANAGE_ADMINS = "manage_admins",
+ MANAGE_USERS = "manage_users",
+
+ // Reports & Finances
+ VIEW_REPORTS = "view_reports",
+
+ UPDATE_RESTAURANT = "update_restaurant",
+
+ // Role Management
+ MANAGE_ROLES = "manage_roles",
+ MANAGE_REVIEWS = "manage_reviews",
+ MANAGE_COUPONS = "manage_coupons",
+ MANAGE_PAYMENTS = "manage_payments",
+ MANAGE_DELIVERY = "manage_delivery",
+ MANAGE_SETTINGS = "manage_settings",
+ MANAGE_SCHEDULES = "manage_schedules",
+ MANAGE_REPORTS = "manage_reports",
+ MANAGE_CONTACTS = "manage_contacts",
+}
diff --git a/src/shared/SideBar.tsx b/src/shared/SideBar.tsx
index f3e6efe..85c5210 100644
--- a/src/shared/SideBar.tsx
+++ b/src/shared/SideBar.tsx
@@ -13,11 +13,15 @@ import OrdersSubMenu from './components/OrdersSubMenu'
import CustomersSubMenu from './components/CustomersSubMenu'
import DiscountSubMenu from './components/DiscountSubMenu'
import { SideBarItemHasSubMenu } from '../config/SideBarSubMenu'
+import { usePermissions } from '@/hooks/usePermissions'
+import { PermissionEnum } from '@/pages/roles/enum/Enum'
+
const SideBar: FC = () => {
const { t } = useTranslation('global')
const { openSidebar, setOpenSidebar, hasSubMenu, setSubMenuName, setSubtMenu, subMenuName } = useSharedStore()
const location = useLocation()
+ const { checkPermission } = usePermissions()
const isActive = (name: string) => {
return location.pathname.includes(name)
@@ -77,113 +81,138 @@ const SideBar: FC = () => {
activeName=''
/>
-