feat(permissions): add dashboard.view permission for cashier/counter/workshop
Some checks failed
CI / lint-and-test (3.11) (push) Has been cancelled
CI / lint-and-test (3.13) (push) Has been cancelled

This commit is contained in:
2026-07-02 22:37:28 +00:00
parent 1b51fe65b5
commit 982315bdaf
20 changed files with 56 additions and 42 deletions

View File

@@ -53,7 +53,8 @@ window.renderSidebar = function(modulesOverride) {
'invoicing.view': 'invoicing',
'quotations.view': 'quotations',
'accounting.view': 'accounting',
'reports.view': 'reports'
'reports.view': 'reports',
'dashboard.view': 'dashboard'
};
for (var p in permMap) {
if (perms.indexOf(p) !== -1 && allowed.indexOf(permMap[p]) === -1) {
@@ -63,10 +64,14 @@ window.renderSidebar = function(modulesOverride) {
return allowed.indexOf(id) !== -1;
}
if (role === 'counter') {
return ['pos','catalog','inventory','customers','workshop','remission_notes','reports'].indexOf(id) !== -1;
var allowed = ['pos','catalog','inventory','customers','workshop','remission_notes','reports'];
if (hasPerm('dashboard.view')) allowed.push('dashboard');
return allowed.indexOf(id) !== -1;
}
if (role === 'cashier') {
return ['pos','catalog','inventory','customers','workshop','remission_notes','invoicing','reports'].indexOf(id) !== -1;
var allowed = ['pos','catalog','inventory','customers','workshop','remission_notes','invoicing','reports'];
if (hasPerm('dashboard.view')) allowed.push('dashboard');
return allowed.indexOf(id) !== -1;
}
return true;
}