Merge c895a852fb
into 55a28e3437
This commit is contained in:
commit
abaa97e0ea
4 changed files with 29 additions and 13 deletions
|
@ -71,7 +71,7 @@ const internalAccessList = {
|
|||
// re-fetch with expansions
|
||||
return internalAccessList.get(access, {
|
||||
id: data.id,
|
||||
expand: ['owner', 'items', 'clients', 'proxy_hosts.access_list.clients']
|
||||
expand: ['owner', 'items', 'clients', 'proxy_hosts']
|
||||
}, true /* <- skip masking */);
|
||||
})
|
||||
.then((row) => {
|
||||
|
@ -216,10 +216,11 @@ const internalAccessList = {
|
|||
// re-fetch with expansions
|
||||
return internalAccessList.get(access, {
|
||||
id: data.id,
|
||||
expand: ['owner', 'items', 'clients', 'proxy_hosts.access_list.clients']
|
||||
expand: ['owner', 'items', 'clients', 'proxy_hosts']
|
||||
}, true /* <- skip masking */);
|
||||
})
|
||||
.then((row) => {
|
||||
console.log(row);
|
||||
return internalAccessList.build(row)
|
||||
.then(() => {
|
||||
if (row.proxy_host_count) {
|
||||
|
@ -254,7 +255,7 @@ const internalAccessList = {
|
|||
.joinRaw('LEFT JOIN `proxy_host` ON `proxy_host`.`access_list_id` = `access_list`.`id` AND `proxy_host`.`is_deleted` = 0')
|
||||
.where('access_list.is_deleted', 0)
|
||||
.andWhere('access_list.id', data.id)
|
||||
.allowEager('[owner,items,clients,proxy_hosts,proxy_hosts.access_list.clients]')
|
||||
.allowEager('[owner, items, clients, proxy_hosts]')
|
||||
.omit(['access_list.is_deleted'])
|
||||
.first();
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ const internalProxyHost = {
|
|||
// re-fetch with cert
|
||||
return internalProxyHost.get(access, {
|
||||
id: row.id,
|
||||
expand: ['certificate', 'owner', 'access_list.clients']
|
||||
expand: ['certificate', 'owner']
|
||||
});
|
||||
})
|
||||
.then((row) => {
|
||||
|
@ -186,7 +186,7 @@ const internalProxyHost = {
|
|||
.then(() => {
|
||||
return internalProxyHost.get(access, {
|
||||
id: data.id,
|
||||
expand: ['owner', 'certificate', 'access_list.clients']
|
||||
expand: ['owner', 'certificate']
|
||||
})
|
||||
.then((row) => {
|
||||
// Configure nginx
|
||||
|
@ -219,7 +219,6 @@ const internalProxyHost = {
|
|||
.query()
|
||||
.where('is_deleted', 0)
|
||||
.andWhere('id', data.id)
|
||||
.allowEager('[owner,access_list,access_list.clients,certificate]')
|
||||
.first();
|
||||
|
||||
if (access_data.permission_visibility !== 'all') {
|
||||
|
@ -304,7 +303,7 @@ const internalProxyHost = {
|
|||
.then(() => {
|
||||
return internalProxyHost.get(access, {
|
||||
id: data.id,
|
||||
expand: ['certificate', 'owner', 'access_list']
|
||||
expand: ['certificate', 'owner']
|
||||
});
|
||||
})
|
||||
.then((row) => {
|
||||
|
@ -406,7 +405,7 @@ const internalProxyHost = {
|
|||
.where('is_deleted', 0)
|
||||
.groupBy('id')
|
||||
.omit(['is_deleted'])
|
||||
.allowEager('[owner,access_list,certificate]')
|
||||
.allowGraph('[owner,certificate]')
|
||||
.orderBy('domain_names', 'ASC');
|
||||
|
||||
if (access_data.permission_visibility !== 'all') {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
// Objection Docs:
|
||||
// http://vincit.github.io/objection.js/
|
||||
|
||||
const db = require('../db');
|
||||
const Model = require('objection').Model;
|
||||
const User = require('./user');
|
||||
const AccessList = require('./access_list');
|
||||
const Certificate = require('./certificate');
|
||||
const db = require('../db');
|
||||
const Model = require('objection').Model;
|
||||
const User = require('./user');
|
||||
const AccessList = require('./access_list');
|
||||
const Certificate = require('./certificate');
|
||||
const ProxyHostQueryBuilder = require('../query/proxy_host');
|
||||
|
||||
Model.knex(db);
|
||||
|
||||
|
@ -36,6 +37,10 @@ class ProxyHost extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
static get QueryBuilder() {
|
||||
return ProxyHostQueryBuilder;
|
||||
}
|
||||
|
||||
static get name () {
|
||||
return 'ProxyHost';
|
||||
}
|
||||
|
|
11
backend/query/proxy_host.js
Normal file
11
backend/query/proxy_host.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
const QueryBuilder = require('objection').QueryBuilder;
|
||||
|
||||
class ProxyHostQueryBuilder extends QueryBuilder {
|
||||
execute () {
|
||||
this.allowGraph('[access_list.[items, clients]]');
|
||||
this.withGraphFetched('[access_list.[items, clients]]');
|
||||
return super.execute();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ProxyHostQueryBuilder;
|
Loading…
Reference in a new issue