setting pushed

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-23 22:34:18 +03:30
co-authored by Cursor
parent d3997cfc8f
commit d2fd315e8a
3 changed files with 306 additions and 10 deletions
@@ -65,29 +65,38 @@ class SettingsController extends Controller
public function edit(Request $request)
{
$setting = Setting::where('key', $request->key)->first();
$key = trim((string) $request->key);
$isDeployAdmin = $this->isDeployAdminUser();
$isSystemDeploy = $request->boolean('system_deploy');
$setting = Setting::where('key', $key)->first();
$isNew = !$setting;
if (SuperAdminProgramSettingsOverlay::isSuperAdminOwned($key)) {
return response()->json([
'message' => 'این تنظیم از سوپرادمین کنترل می‌شود و در پنل خانگی قابل ویرایش نیست',
], 403);
}
if ($isNew) {
if ($request->boolean('system_deploy')) {
if ($isSystemDeploy && !$isDeployAdmin) {
return response()->json([
'message' => 'تنظیمات پیشرفته فقط از سوپرادمین اضافه می‌شوند',
'message' => 'افزودن تنظیم پیشرفته فقط برای ادمین دیپلوی مجاز است',
], 403);
}
$setting = new Setting();
$setting->key = $request->key;
$setting->can_edit = 1;
$setting->key = $key;
$setting->can_edit = $isSystemDeploy ? 0 : 1;
} elseif (
SuperAdminProgramSettingsOverlay::isRuntime((string) $request->key)
&& ! $this->isPanelManagedKey((string) $request->key)
SuperAdminProgramSettingsOverlay::isRuntime($key)
&& ! $this->isPanelManagedKey($key)
) {
return response()->json([
'message' => 'این مقدار توسط سیستم به‌روز می‌شود و از پنل قابل ویرایش نیست',
], 403);
} elseif (!$setting->can_edit && !$this->isPanelManagedKey((string) $request->key)) {
} elseif (!$setting->can_edit && !$isDeployAdmin && !$this->isPanelManagedKey($key)) {
return response()->json([
'message' => 'این تنظیم از سوپرادمین کنترل می‌شود و در پنل خانگی قابل ویرایش نیست',
'message' => 'این تنظیم پیشرفته است و فقط ادمین دیپلوی می‌تواند آن را تغییر دهد',
], 403);
}