Blacklist functionality

Some API improvements
This commit is contained in:
Tomas Bures 2017-09-17 16:36:23 +02:00
parent c343e4efd3
commit 9203b5cee7
40 changed files with 726 additions and 398 deletions

View file

@ -19,7 +19,10 @@ async function getAnonymousConfig(context) {
async function getAuthenticatedConfig(context) {
return {
defaultCustomFormValues: await forms.getDefaultCustomFormValues(),
userId: context.user.id,
user: {
id: context.user.id,
namespace: context.user.namespace
},
globalPermissions: shares.getGlobalPermissions(context)
}
}

View file

@ -28,6 +28,7 @@ async function ajaxListTx(tx, params, queryFun, columns, options) {
const query = queryFun(tx);
query.whereIn(columnsNames[parseInt(params.column)], params.values);
query.select(columnsSelect);
query.options({rowsAsArray:true});
const rows = await query;
const rowsOfArray = rows.map(row => Object.keys(row).map(key => row[key]));

View file

@ -7,7 +7,7 @@ const interoperableErrors = require('../shared/interoperable-errors');
async function validateEntity(tx, entity) {
enforce(entity.namespace, 'Entity namespace not set');
if (!await tx('namespaces').where('id', entity.namespace).first()) {
throw new interoperableErrors.DependencyNotFoundError();
throw new interoperableErrors.NamespaceNotFoundError();
}
}