feat(settings): add enable_automation SuperAdmin switch (default off)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -17,6 +17,15 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"type": "switch"
|
"type": "switch"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "enable_automation",
|
||||||
|
"value": "false",
|
||||||
|
"title_fa": "اتوماسیون",
|
||||||
|
"can_edit": 0,
|
||||||
|
"is_active": 1,
|
||||||
|
"description": "روشن: منوی اتوماسیون در پنل ادمین و اجرای موتور فعال است. خاموش: منو مخفی است و API/کران اجرا نمیشود. فقط از سوپرادمین قابل تغییر است.",
|
||||||
|
"type": "switch"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "enable_conditional_order",
|
"key": "enable_conditional_order",
|
||||||
"value": "",
|
"value": "",
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ for (const key of EXTRA_EDITABLE) {
|
|||||||
const SUPERADMIN_OWNED_KEYS = new Set([
|
const SUPERADMIN_OWNED_KEYS = new Set([
|
||||||
'customer_direct_sms',
|
'customer_direct_sms',
|
||||||
'customer_special_pricing',
|
'customer_special_pricing',
|
||||||
|
'enable_automation',
|
||||||
'enable_conditional_order',
|
'enable_conditional_order',
|
||||||
'enable_customer_level_profit',
|
'enable_customer_level_profit',
|
||||||
'enable_product_funds',
|
'enable_product_funds',
|
||||||
@@ -224,6 +225,28 @@ const SUPERADMIN_OWNED_KEYS = new Set([
|
|||||||
'show_to_users_chat',
|
'show_to_users_chat',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/** متادیتای کلیدهای SA که INSERTشان در SQL کامنت شده — برای قالب سوپرادمین */
|
||||||
|
const SUPERADMIN_OWNED_META = {
|
||||||
|
enable_automation: {
|
||||||
|
value: 'false',
|
||||||
|
title_fa: 'اتوماسیون',
|
||||||
|
description:
|
||||||
|
'روشن: منوی اتوماسیون در پنل ادمین و اجرای موتور فعال است. خاموش: منو مخفی است و API/کران اجرا نمیشود. فقط از سوپرادمین قابل تغییر است.',
|
||||||
|
type: 'switch',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const [key, meta] of Object.entries(SUPERADMIN_OWNED_META)) {
|
||||||
|
const row = ensureRow(key);
|
||||||
|
if (!row) continue;
|
||||||
|
row.can_edit = 0;
|
||||||
|
row.is_active = 1;
|
||||||
|
if (meta.value !== undefined) row.value = meta.value;
|
||||||
|
if (meta.title_fa) row.title_fa = meta.title_fa;
|
||||||
|
if (meta.description) row.description = meta.description;
|
||||||
|
if (meta.type) row.type = meta.type;
|
||||||
|
}
|
||||||
|
|
||||||
const systemRows = [...rows.values()]
|
const systemRows = [...rows.values()]
|
||||||
.filter((r) => r.can_edit === 0 && SUPERADMIN_OWNED_KEYS.has(r.key))
|
.filter((r) => r.can_edit === 0 && SUPERADMIN_OWNED_KEYS.has(r.key))
|
||||||
.sort((a, b) => a.key.localeCompare(b.key));
|
.sort((a, b) => a.key.localeCompare(b.key));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
export const DEPLOY_SETTING_CATALOG_KEYS = new Set<string>([
|
export const DEPLOY_SETTING_CATALOG_KEYS = new Set<string>([
|
||||||
"customer_direct_sms",
|
"customer_direct_sms",
|
||||||
"customer_special_pricing",
|
"customer_special_pricing",
|
||||||
|
"enable_automation",
|
||||||
"enable_conditional_order",
|
"enable_conditional_order",
|
||||||
"enable_customer_level_profit",
|
"enable_customer_level_profit",
|
||||||
"enable_product_funds",
|
"enable_product_funds",
|
||||||
@@ -20,8 +21,7 @@ export const DEPLOY_SETTING_CATALOG_KEYS = new Set<string>([
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* کلیدهایی که سوپرادمین مالکشان نیست (مالک: دیتابیس هر نصب).
|
* کلیدهایی که سوپرادمین مالکشان نیست (مالک: دیتابیس هر نصب).
|
||||||
* در هر بوت از قالب حذف میشوند؛ از ردیف هر پروژه فقط با دکمهٔ
|
* در هر بوت از قالب حذف میشوند؛ از ردیف هر پروژه فقط با دکمهٔ صفحهٔ تنظیمات همان پروژه.
|
||||||
* «حذف تنظیمات غیر دسترسی» در صفحهٔ تنظیمات همان پروژه.
|
|
||||||
*/
|
*/
|
||||||
export const DEPLOY_SETTING_EDITABLE_KEYS = new Set<string>([
|
export const DEPLOY_SETTING_EDITABLE_KEYS = new Set<string>([
|
||||||
"about_software",
|
"about_software",
|
||||||
|
|||||||
Reference in New Issue
Block a user