fix: restore write permissions in local-only mode

RBAC permission checks (has()) always deferred to the cloud
workspace's role, which is null when using "work locally without
internet" — so every guarded action (save/delete order, edit catalog,
etc.) was blocked with "no permission" even though there is no
workspace to restrict against. Local-only mode now grants full access,
matching how nav permissions already behave with no cloud session.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
pavlov346346-source 2026-09-15 17:49:05 +03:00
parent 26681195b0
commit 3610927a33

View File

@ -3334,7 +3334,7 @@ window.SUN_LEGACY_CATALOG_V175=[{"id":"1","name":"Фуршетный бокс
function workspace(){ return cloud()?.getWorkspace?.() || null; }
function session(){ return cloud()?.getSession?.() || null; }
function client(){ return cloud()?.getClient?.() || null; }
function has(p){ const c=cloud(); return c?.hasPermission ? c.hasPermission(p) : false; }
function has(p){ try{if(localStorage.getItem('sunLocalOnlyModeV1')==='1')return true;}catch(_){} const c=cloud(); return c?.hasPermission ? c.hasPermission(p) : false; }
function currentPermissions(){ return workspace()?.permissions || {}; }
function normalizeLegacyLocalAuth(){