@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 9d3702a
Fork 0

سامانه صدور فاکتور و حسابداری

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 3, 20:45 UTC

test: require visible organization switch surface

davoodmehraban89 committed Sep 30, 2026 at 06:59 UTC 9d3702a7a023467b2f5805b4c847d24311d7301c
1 file changed +3 -2
scripts/slice-b-rbac-check.mjs
+3 -2
@@ -8,8 +8,9 @@ const must=['create table public.organizations','create table public.organizatio
8 for(const token of must)if(!sql.includes(token))throw new Error(`missing Slice B invariant: ${token}`);
9 if(/drop\s+table\s+public\.records/i.test(sql))throw new Error('Slice B must not destructively replace records');
10 if(/user_metadata/i.test(sql))throw new Error('authorization must not trust user_metadata');
11 -const org=fs.readFileSync(path.join(root,'js','organization-rbac.js'),'utf8'),office=fs.readFileSync(path.join(root,'js','office-rbac.js'),'utf8'),boot=fs.readFileSync(path.join(root,'js','bootstrap.js'),'utf8');
11 +const org=fs.readFileSync(path.join(root,'js','organization-rbac.js'),'utf8'),office=fs.readFileSync(path.join(root,'js','office-rbac.js'),'utf8'),shell=fs.readFileSync(path.join(root,'js','organization-shell.js'),'utf8'),boot=fs.readFileSync(path.join(root,'js','bootstrap.js'),'utf8');
12 for(const token of ['organizationId','modulePermissions','commercialModules','hasFinoraCapability','p_organization_id:currentUser.organizationId','organization_set_member_permission','organization_add_member'])if(!org.includes(token))throw new Error(`missing organization client invariant: ${token}`);
13 for(const token of ["cap('configure')","cap('create')","cap('register')","cap('refer')",'office_refer_correspondence',"currentUser.organizationId+'/'+currentUser.id+'/'+correspondenceId"])if(!office.includes(token))throw new Error(`missing office capability invariant: ${token}`);
14 -if(!boot.includes('organization-rbac.js')||!boot.includes('office-rbac.js'))throw new Error('Slice B extensions are not loaded by bootstrap');
14 +for(const token of ['showFinoraOrganizationSwitcher','finora-org-switch-btn','showOrganizationAccessManager'])if(!shell.includes(token))throw new Error(`missing organization shell invariant: ${token}`);
15 +if(!boot.includes('organization-rbac.js')||!boot.includes('office-rbac.js')||!boot.includes('organization-shell.js'))throw new Error('Slice B extensions are not loaded by bootstrap');
16 console.log(`Slice B tenant/RBAC invariants PASS (${requiredFiles.join(', ')})`);