feat: add configurable permissions system with admin panel
Adds a full permissions management feature allowing admins to control who can perform actions across the app (trip CRUD, files, places, budget, packing, reservations, collab, members, share links). - New server/src/services/permissions.ts: 16 configurable actions, in-memory cache, checkPermission() helper, backwards-compatible defaults matching upstream behaviour - GET/PUT /admin/permissions endpoints; permissions loaded into app-config response so clients have them on startup - checkPermission() applied to all mutating route handlers across 10 server route files; getTripOwnerId() helper eliminates repeated inline DB queries; trips.ts and files.ts now reuse canAccessTrip() result to avoid redundant DB round-trips - New client/src/store/permissionsStore.ts: Zustand store + useCanDo() hook; TripOwnerContext type accepts both Trip and DashboardTrip shapes without casting at call sites - New client/src/components/Admin/PermissionsPanel.tsx: categorised UI with per-action dropdowns, customised badge, save/reset - AdminPage, DashboardPage, FileManager, PlacesSidebar, TripMembersModal gated via useCanDo(); no prop drilling - 46 perm.* translation keys added to all 12 language files
This commit is contained in:
@@ -1423,6 +1423,55 @@ const ar: Record<string, string | { name: string; category: string }[]> = {
|
||||
'collab.polls.options': 'الخيارات',
|
||||
'collab.polls.delete': 'حذف',
|
||||
'collab.polls.closedSection': 'مغلق',
|
||||
|
||||
// Permissions
|
||||
'admin.tabs.permissions': 'الصلاحيات',
|
||||
'perm.title': 'إعدادات الصلاحيات',
|
||||
'perm.subtitle': 'التحكم في من يمكنه تنفيذ الإجراءات عبر التطبيق',
|
||||
'perm.saved': 'تم حفظ إعدادات الصلاحيات',
|
||||
'perm.resetDefaults': 'إعادة التعيين إلى الافتراضي',
|
||||
'perm.customized': 'مخصص',
|
||||
'perm.level.admin': 'المسؤول فقط',
|
||||
'perm.level.tripOwner': 'مالك الرحلة',
|
||||
'perm.level.tripMember': 'أعضاء الرحلة',
|
||||
'perm.level.everybody': 'الجميع',
|
||||
'perm.cat.trip': 'إدارة الرحلات',
|
||||
'perm.cat.members': 'إدارة الأعضاء',
|
||||
'perm.cat.files': 'الملفات',
|
||||
'perm.cat.content': 'المحتوى والجدول الزمني',
|
||||
'perm.cat.extras': 'الميزانية والتعبئة والتعاون',
|
||||
'perm.action.trip_create': 'إنشاء رحلات',
|
||||
'perm.action.trip_edit': 'تعديل تفاصيل الرحلة',
|
||||
'perm.action.trip_delete': 'حذف الرحلات',
|
||||
'perm.action.trip_archive': 'أرشفة / إلغاء أرشفة الرحلات',
|
||||
'perm.action.trip_cover_upload': 'رفع صورة الغلاف',
|
||||
'perm.action.member_manage': 'إضافة / إزالة الأعضاء',
|
||||
'perm.action.file_upload': 'رفع الملفات',
|
||||
'perm.action.file_edit': 'تعديل بيانات الملف',
|
||||
'perm.action.file_delete': 'حذف الملفات',
|
||||
'perm.action.place_edit': 'إضافة / تعديل / حذف الأماكن',
|
||||
'perm.action.day_edit': 'تعديل الأيام والملاحظات والتعيينات',
|
||||
'perm.action.reservation_edit': 'إدارة الحجوزات',
|
||||
'perm.action.budget_edit': 'إدارة الميزانية',
|
||||
'perm.action.packing_edit': 'إدارة قوائم التعبئة',
|
||||
'perm.action.collab_edit': 'التعاون (ملاحظات، استطلاعات، دردشة)',
|
||||
'perm.action.share_manage': 'إدارة روابط المشاركة',
|
||||
'perm.actionHint.trip_create': 'من يمكنه إنشاء رحلات جديدة',
|
||||
'perm.actionHint.trip_edit': 'من يمكنه تغيير اسم الرحلة والتواريخ والوصف والعملة',
|
||||
'perm.actionHint.trip_delete': 'من يمكنه حذف رحلة نهائياً',
|
||||
'perm.actionHint.trip_archive': 'من يمكنه أرشفة أو إلغاء أرشفة رحلة',
|
||||
'perm.actionHint.trip_cover_upload': 'من يمكنه رفع أو تغيير صورة الغلاف',
|
||||
'perm.actionHint.member_manage': 'من يمكنه دعوة أو إزالة أعضاء الرحلة',
|
||||
'perm.actionHint.file_upload': 'من يمكنه رفع ملفات إلى رحلة',
|
||||
'perm.actionHint.file_edit': 'من يمكنه تعديل أوصاف الملفات والروابط',
|
||||
'perm.actionHint.file_delete': 'من يمكنه نقل الملفات إلى سلة المهملات أو حذفها نهائياً',
|
||||
'perm.actionHint.place_edit': 'من يمكنه إضافة أو تعديل أو حذف الأماكن',
|
||||
'perm.actionHint.day_edit': 'من يمكنه تعديل الأيام وملاحظات الأيام وتعيينات الأماكن',
|
||||
'perm.actionHint.reservation_edit': 'من يمكنه إنشاء أو تعديل أو حذف الحجوزات',
|
||||
'perm.actionHint.budget_edit': 'من يمكنه إنشاء أو تعديل أو حذف عناصر الميزانية',
|
||||
'perm.actionHint.packing_edit': 'من يمكنه إدارة عناصر التعبئة والحقائب',
|
||||
'perm.actionHint.collab_edit': 'من يمكنه إنشاء ملاحظات واستطلاعات وإرسال رسائل',
|
||||
'perm.actionHint.share_manage': 'من يمكنه إنشاء أو حذف روابط المشاركة العامة',
|
||||
}
|
||||
|
||||
export default ar
|
||||
|
||||
Reference in New Issue
Block a user