feat: gate treasury as an org module and group money inputs
Link optional invoice and cheque settlements to cash accounts, and let superadmin enable the finance module per organization. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -557,6 +557,10 @@ router.beforeEach((to) => {
|
||||
) {
|
||||
return { name: 'home' };
|
||||
}
|
||||
if (String(to.path).startsWith('/finance')) {
|
||||
const modules = auth.user?.enabledModules;
|
||||
if (modules && !modules.includes('treasury')) return { name: 'home' };
|
||||
}
|
||||
const roles = to.meta.roles as UserRole[] | undefined;
|
||||
if (roles?.length) {
|
||||
const role = auth.user?.role as UserRole | undefined;
|
||||
@@ -566,6 +570,12 @@ router.beforeEach((to) => {
|
||||
if (to.name === 'team-settings' && auth.user?.viewAs?.canOpenTeamSettings) {
|
||||
return true;
|
||||
}
|
||||
if (String(to.path).startsWith('/finance')) {
|
||||
const perms = auth.user?.permissions ?? [];
|
||||
const payroll = to.path.startsWith('/finance/payroll');
|
||||
if (payroll && perms.includes('treasury_payroll')) return true;
|
||||
if (!payroll && (perms.includes('treasury') || perms.includes('treasury_payroll'))) return true;
|
||||
}
|
||||
return { name: 'home' };
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user