Skip to content

Commit 84d8fb0

Browse files
authored
Merge pull request #403 from Indemnity83/empty-auth
Don't ask for username/password if none are defined
2 parents 55a28e3 + df73c2a commit 84d8fb0

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

backend/internal/access-list.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const internalAccessList = {
7171
// re-fetch with expansions
7272
return internalAccessList.get(access, {
7373
id: data.id,
74-
expand: ['owner', 'items', 'clients', 'proxy_hosts.access_list.clients']
74+
expand: ['owner', 'items', 'clients', 'proxy_hosts.access_list.clients', 'proxy_hosts.access_list.items']
7575
}, true /* <- skip masking */);
7676
})
7777
.then((row) => {
@@ -216,7 +216,7 @@ const internalAccessList = {
216216
// re-fetch with expansions
217217
return internalAccessList.get(access, {
218218
id: data.id,
219-
expand: ['owner', 'items', 'clients', 'proxy_hosts.access_list.clients']
219+
expand: ['owner', 'items', 'clients', 'proxy_hosts.access_list.clients', 'proxy_hosts.access_list.items']
220220
}, true /* <- skip masking */);
221221
})
222222
.then((row) => {
@@ -254,7 +254,7 @@ const internalAccessList = {
254254
.joinRaw('LEFT JOIN `proxy_host` ON `proxy_host`.`access_list_id` = `access_list`.`id` AND `proxy_host`.`is_deleted` = 0')
255255
.where('access_list.is_deleted', 0)
256256
.andWhere('access_list.id', data.id)
257-
.allowEager('[owner,items,clients,proxy_hosts,proxy_hosts.access_list.clients]')
257+
.allowEager('[owner,items,clients,proxy_hosts,proxy_hosts.access_list.clients,proxy_hosts.access_list.items]')
258258
.omit(['access_list.is_deleted'])
259259
.first();
260260

backend/internal/proxy-host.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const internalProxyHost = {
7373
// re-fetch with cert
7474
return internalProxyHost.get(access, {
7575
id: row.id,
76-
expand: ['certificate', 'owner', 'access_list.clients']
76+
expand: ['certificate', 'owner', 'access_list.clients', 'access_list.items']
7777
});
7878
})
7979
.then((row) => {
@@ -186,7 +186,7 @@ const internalProxyHost = {
186186
.then(() => {
187187
return internalProxyHost.get(access, {
188188
id: data.id,
189-
expand: ['owner', 'certificate', 'access_list.clients']
189+
expand: ['owner', 'certificate', 'access_list.clients', 'access_list.items']
190190
})
191191
.then((row) => {
192192
// Configure nginx
@@ -219,7 +219,7 @@ const internalProxyHost = {
219219
.query()
220220
.where('is_deleted', 0)
221221
.andWhere('id', data.id)
222-
.allowEager('[owner,access_list,access_list.clients,certificate]')
222+
.allowEager('[owner,access_list,access_list.clients,access_list.items,certificate]')
223223
.first();
224224

225225
if (access_data.permission_visibility !== 'all') {

backend/templates/proxy_host.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ server {
2323
location / {
2424

2525
{% if access_list_id > 0 %}
26+
{% if access_list.items.length > 0 %}
2627
# Authorization
2728
auth_basic "Authorization required";
2829
auth_basic_user_file /data/access/{{ access_list_id }};
30+
{% endif %}
2931

3032
# Access Rules
3133
{% for client in access_list.clients %}

0 commit comments

Comments
 (0)