Fluid layout

Reworked routing and breadcrumb mechanism. It allows resolved parameters in paths, which allows including names of entities in the breadcrumb.
Secondary navigation which is aware of permissions.
This commit is contained in:
Tomas Bures 2017-08-11 18:16:44 +02:00
parent 86fce404a9
commit 602364caae
33 changed files with 808 additions and 907 deletions

View file

@ -518,6 +518,17 @@ async function enforceTypePermissionTx(tx, context, entityTypeId, requiredOperat
}
}
async function getPermissions(tx, context, entityTypeId, entityId) {
const entityType = permissions.getEntityType(entityTypeId);
const rows = await tx(entityType.permissionsTable)
.select('operation')
.where('entity', entityId)
.where('user', context.user.id);
return rows.map(x => x.operation);
}
module.exports = {
listByEntityDTAjax,
@ -535,5 +546,6 @@ module.exports = {
checkTypePermission,
enforceGlobalPermission,
throwPermissionDenied,
regenerateRoleNamesTable
regenerateRoleNamesTable,
getPermissions
};