Files can be added to templates and managed in a dedicated "Files" view.

Mosaico integration in progress. The files seem to be working for Mosaico.
This commit is contained in:
Tomas Bures 2018-03-24 23:55:50 +01:00
parent c85f2d4440
commit b5cdf57f72
23 changed files with 506 additions and 164 deletions

View file

@ -414,6 +414,10 @@ async function removeDefaultShares(tx, user) {
}
function checkGlobalPermission(context, requiredOperations) {
if (!context.user) {
return false;
}
if (context.user.admin) { // This handles the getAdminContext() case
return true;
}
@ -443,6 +447,10 @@ function enforceGlobalPermission(context, requiredOperations) {
}
async function _checkPermissionTx(tx, context, entityTypeId, entityId, requiredOperations) {
if (!context.user) {
return false;
}
const entityType = permissions.getEntityType(entityTypeId);
if (context.user.admin) { // This handles the getAdminContext() case. In this case we don't check the permission, but just the existence.
@ -530,12 +538,20 @@ async function enforceTypePermissionTx(tx, context, entityTypeId, requiredOperat
}
function getGlobalPermissions(context) {
if (!context.user) {
return [];
}
enforce(!context.user.admin, 'getPermissions is not supposed to be called by assumed admin');
return (config.roles.global[context.user.role] || {}).permissions || [];
}
async function getPermissionsTx(tx, context, entityTypeId, entityId) {
if (!context.user) {
return [];
}
enforce(!context.user.admin, 'getPermissions is not supposed to be called by assumed admin');
const entityType = permissions.getEntityType(entityTypeId);