Templates namespace filtering & fix

This commit is contained in:
Carlos 2019-03-20 08:57:06 +01:00
parent b6a896558e
commit 444717b4d0
5 changed files with 34 additions and 7 deletions

View file

@ -46,6 +46,16 @@ async function listDTAjax(context, params) {
);
}
async function listByNamespaceDTAjax(context, params, namespaceId) {
return await dtHelpers.ajaxListWithPermissions(
context,
[{ entityTypeId: 'template', requiredOperations: ['view'] }],
params,
builder => builder.from('templates').innerJoin('namespaces', 'namespaces.id', 'templates.namespace').where('namespaces.id', namespaceId),
[ 'templates.id', 'templates.name', 'templates.description', 'templates.type', 'templates.created', 'namespaces.name' ]
);
}
async function _validateAndPreprocess(tx, entity) {
await namespaceHelpers.validateEntity(tx, entity);
@ -135,6 +145,7 @@ module.exports.hash = hash;
module.exports.getByIdTx = getByIdTx;
module.exports.getById = getById;
module.exports.listDTAjax = listDTAjax;
module.exports.listByNamespaceDTAjax = listByNamespaceDTAjax;
module.exports.create = create;
module.exports.updateWithConsistencyCheck = updateWithConsistencyCheck;
module.exports.remove = remove;