انتقل إلى المحتوى الرئيسي

ApplicationPermissions

PERMISSIONS.md

ProjectSardine Permissions System

This document describes the structure and usage of the permission system used in the ProjectSardine API. The system categorizes permissions under several groups and uses static string constants annotated with Description attributes for display purposes.


📦 Permission Structure

Permissions are defined in a static class AppPerms under the namespace:

ProjectSardine.Api.ApplicationPermissions.Services

Each permission group is a nested static class with string constants representing each permission.


🧾 Permission Groups & Permissions

🔐 Accounts — صلاحيات الحسابات

KeyDescription
Accounts.AddAccountإضافة حساب جديد
Accounts.GetAccountsعرض قائمة الحسابات
Accounts.UpdateAccountتحديث الحساب
Accounts.DeleteAccountحذف الحساب

🪟 Windows — صلاحيات الواجهات

KeyDescription
Windows.MonitorWindowالدخول الى واجهة المراقبة
Windows.Restaurantواجهة المطعم
Windows.ProductsWindowواجهة المنتجات
Windows.Managementواجهة الادارة
Windows.Reportsواجهة التقارير
Windows.Financeواجهة المالية
Windows.Settingsواجهة الاعدادات

🔁 Transactions — صلاحيات المعاملات

KeyDescription
Transactions.AddExpenseإضافة سند صرف
Transactions.GetExpensesعرض سند صرف
Transactions.DeleteExpenseحذف سند صرف
Transactions.AddPaymentإضافة سند دفع
Transactions.GetPaymentsعرض سند دفع
Transactions.DeletePaymentحذف سند دفع
Transactions.AddReceiptإضافة سند قبض
Transactions.GetReceiptsعرض سند قبض
Transactions.DeleteReceiptحذف سند قبض
Transactions.Printطباعة السندات

🖨️ Printers — الطابعات

KeyDescription
Printers.FullPrinterPermissionsتحكم كامل في الطابعات

🍽️ Products — صلاحيات المنتجات

KeyDescription
Products.CookedItemsAccessالدخول إلى العناصر المطبوخة
Products.AddCookedItemإضافة أكلة في العناصر المطبوخة
Products.DeleteCookedItemحذف أكلة في العناصر المطبوخة
Products.UpdateCookedItemتعديل أكلة في العناصر المطبوخة
Products.ManageGroupsالتحكم بالمجموعات
Products.ReadyToSellItemsالعناصر الجاهزة للبيع
Products.BasicIngredeintsالمواد الأولية

🍴 Restaurant — صلاحيات المطعم

KeyDescription
Restaurant.ManageKitchensالتحكم بالمطابخ
Restaurant.ManageHallsالتحكم بالقاعات
Restaurant.ManageTablesالتحكم بالطاولات
Restaurant.ManageDeliveryAdminالتحكم بالتوصيل (الإدارة)
Restaurant.ManageSettingsالتحكم بالإعدادات

👀 Monitor — صلاحيات المراقبة

KeyDescription
Monitor.DecreaseAfterPrintإنقاص العدد بعد الطباعة للمطبخ
Monitor.DeleteAfterPrintحذف مادة من القائمة بعد الطباعة للمطبخ
Monitor.ChangeMealPriceتغيير سعر الأكلة
Monitor.SaveAndPrintToKitchenحفظ وطباعة للمطبخ سفري/صالة
Monitor.PrintCustomerBillطباعة الحساب للزبون سفري/صالة
Monitor.MoveOrderنقل الطلب بين الطاولات
Monitor.CancelOrderحذف الطلب أو الإلغاء
Monitor.AddCustomerإضافة زبون جديد
Monitor.NotPayedFullyInAdvancedالبيع بالآجل للزبائن
Monitor.AddDiscountاضافة خصم
Monitor.HandleDeliveryOrdersالتعامل مع طلبات السفري

🛠️ Services & Utilities

AppPermsService

  • GetAllPermissions() — Returns a grouped list of permissions with descriptions.
  • GetAllPermissionsList() — Returns a flat list of all permission keys.
  • Uses DescriptionAttribute to fetch display-friendly text for each permission.

PermissionsManager

  • Handles database and cache-level interactions for permission checks.

  • Key methods:

    • GetAllPermissionsFromDbAsync
    • GetPermissionsForUser
    • GetRolePermissions
    • HasPermission

📌 Notes

  • PermissionsEntity holds a permission entry associated with a RoleId.
  • Permissions are typically assigned per role and cached for performance.
  • Use the Description attribute for multilingual or friendly UI display.