reels
This commit is contained in:
27
utils/subUserPermissions.js
Normal file
27
utils/subUserPermissions.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// کاتالوگِ پرمیژنهایی که صاحبِ اکانت میتونه به کاربرِ زیرمجموعه بده — مطابقِ
|
||||
// utils/panelPermissions.js (همون الگو برای پنلِ ادمین)
|
||||
const SUB_USER_PERMISSIONS = [
|
||||
{ key: 'posts_stories', label: 'ثبت پست و استوری' },
|
||||
{ key: 'reply_dm', label: 'جواب دادن به دایرکت' },
|
||||
{ key: 'reply_comments', label: 'جواب دادن به کامنت' },
|
||||
{ key: 'create_shop', label: 'ساخت فروشگاه' },
|
||||
{ key: 'shop_products', label: 'ثبت و ویرایش کالا' },
|
||||
{ key: 'order_status', label: 'تغییر وضعیت سفارشات' },
|
||||
{ key: 'billboards', label: 'ساخت و ویرایش بیلبورد' },
|
||||
{ key: 'projects', label: 'ساخت و مدیریت پروژه' },
|
||||
{ key: 'academy_packages', label: 'ساخت و مدیریت پکیج آموزشی' },
|
||||
{ key: 'bookings', label: 'ساخت رزرو آنلاین' }
|
||||
]
|
||||
|
||||
const SUB_USER_PERMISSION_KEYS = new Set(SUB_USER_PERMISSIONS.map((p) => p.key))
|
||||
|
||||
function sanitizeSubUserPermissions (input) {
|
||||
if (!Array.isArray(input)) return []
|
||||
return [...new Set(input.filter((key) => SUB_USER_PERMISSION_KEYS.has(key)))]
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
SUB_USER_PERMISSIONS,
|
||||
SUB_USER_PERMISSION_KEYS,
|
||||
sanitizeSubUserPermissions
|
||||
}
|
||||
Reference in New Issue
Block a user