File tree Expand file tree Collapse file tree 8 files changed +71
-1
lines changed Expand file tree Collapse file tree 8 files changed +71
-1
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ const internalAccessList = {
3131 . insertAndFetch ( {
3232 name : data . name ,
3333 satisfy_any : data . satisfy_any ,
34+ pass_auth : data . pass_auth ,
3435 owner_user_id : access . token . getUserId ( 1 )
3536 } ) ;
3637 } )
@@ -128,6 +129,7 @@ const internalAccessList = {
128129 . patch ( {
129130 name : data . name ,
130131 satisfy_any : data . satisfy_any ,
132+ pass_auth : data . pass_auth ,
131133 } ) ;
132134 }
133135 } )
Original file line number Diff line number Diff line change 1+ const migrate_name = 'pass_auth' ;
2+ const logger = require ( '../logger' ) . migrate ;
3+
4+ /**
5+ * Migrate
6+ *
7+ * @see http://knexjs.org/#Schema
8+ *
9+ * @param {Object } knex
10+ * @param {Promise } Promise
11+ * @returns {Promise }
12+ */
13+ exports . up = function ( knex /*, Promise*/ ) {
14+
15+ logger . info ( '[' + migrate_name + '] Migrating Up...' ) ;
16+
17+ return knex . schema . table ( 'access_list' , function ( access_list ) {
18+ access_list . integer ( 'pass_auth' ) . notNull ( ) . defaultTo ( 1 ) ;
19+ } )
20+ . then ( ( ) => {
21+ logger . info ( '[' + migrate_name + '] access_list Table altered' ) ;
22+ } ) ;
23+ } ;
24+
25+ /**
26+ * Undo Migrate
27+ *
28+ * @param {Object } knex
29+ * @param {Promise } Promise
30+ * @returns {Promise }
31+ */
32+ exports . down = function ( knex /*, Promise*/ ) {
33+ logger . info ( '[' + migrate_name + '] Migrating Down...' ) ;
34+
35+ return knex . schema . table ( 'access_list' , function ( access_list ) {
36+ access_list . dropColumn ( 'pass_auth' ) ;
37+ } )
38+ . then ( ( ) => {
39+ logger . info ( '[' + migrate_name + '] access_list pass_auth Column dropped' ) ;
40+ } ) ;
41+ } ;
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ class AccessList extends Model {
9393 get satisfy ( ) {
9494 return this . satisfy_any ? 'satisfy any' : 'satisfy all' ;
9595 }
96+
97+ get passauth ( ) {
98+ return this . pass_auth ? '' : 'proxy_set_header Authorization "";' ;
99+ }
96100}
97101
98102module . exports = AccessList ;
Original file line number Diff line number Diff line change 4242 "satisfy_any" : {
4343 "type" : " boolean"
4444 },
45+ "pass_auth" : {
46+ "type" : " boolean"
47+ },
4548 "meta" : {
4649 "type" : " object"
4750 }
102105 "satisfy_any" : {
103106 "$ref" : " #/definitions/satisfy_any"
104107 },
108+ "pass_auth" : {
109+ "$ref" : " #/definitions/pass_auth"
110+ },
105111 "items" : {
106112 "type" : " array" ,
107113 "minItems" : 0 ,
167173 "satisfy_any" : {
168174 "$ref" : " #/definitions/satisfy_any"
169175 },
176+ "pass_auth" : {
177+ "$ref" : " #/definitions/pass_auth"
178+ },
170179 "items" : {
171180 "type" : " array" ,
172181 "minItems" : 0 ,
Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ server {
2727 # Authorization
2828 auth_basic "Authorization required";
2929 auth_basic_user_file /data/access/{{ access_list_id }};
30+
31+ {{ access_list.passauth }}
3032 {% endif %}
3133
3234 # Access Rules
Original file line number Diff line number Diff line change 3131 </label >
3232 </div >
3333 </div >
34+
35+ <div class =" col-sm-6 col-md-6" >
36+ <div class =" form-group" >
37+ <label class =" custom-switch" >
38+ <input type =" checkbox" class =" custom-switch-input" name =" pass_auth" value =" 1" <%- typeof pass_auth ! == ' undefined' && pass_auth ? ' checked' : ' ' % >>
39+ <span class =" custom-switch-indicator" ></span >
40+ <span class =" custom-switch-description" ><% - i18n (' access-lists' , ' pass-auth' ) %> </span >
41+ </label >
42+ </div >
43+ </div >
3444 </div >
3545 </div >
3646
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ module.exports = Mn.View.extend({
7373 let data = {
7474 name : form_data . name ,
7575 satisfy_any : ! ! form_data . satisfy_any ,
76+ pass_auth : ! ! form_data . pass_auth ,
7677 items : items_data ,
7778 clients : clients_data
7879 } ;
Original file line number Diff line number Diff line change 206206 "authorization" : " Authorization" ,
207207 "access" : " Access" ,
208208 "satisfy" : " Satisfy" ,
209- "satisfy-any" : " Satisfy Any"
209+ "satisfy-any" : " Satisfy Any" ,
210+ "pass-auth" : " Pass Auth to Host"
210211 },
211212 "users" : {
212213 "title" : " Users" ,
You can’t perform that action at this time.
0 commit comments