mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 15:53:33 +00:00 
			
		
		
		
	add satisfy configuration to the ui
This commit is contained in:
		| @@ -30,6 +30,7 @@ const internalAccessList = { | |||||||
| 					.omit(omissions()) | 					.omit(omissions()) | ||||||
| 					.insertAndFetch({ | 					.insertAndFetch({ | ||||||
| 						name:          data.name, | 						name:          data.name, | ||||||
|  | 						satify_any:    data.satify_any, | ||||||
| 						owner_user_id: access.token.getUserId(1) | 						owner_user_id: access.token.getUserId(1) | ||||||
| 					}); | 					}); | ||||||
| 			}) | 			}) | ||||||
| @@ -125,7 +126,8 @@ const internalAccessList = { | |||||||
| 						.query() | 						.query() | ||||||
| 						.where({id: data.id}) | 						.where({id: data.id}) | ||||||
| 						.patch({ | 						.patch({ | ||||||
| 							name: data.name | 							name:       data.name, | ||||||
|  | 							satify_any: data.satify_any, | ||||||
| 						}); | 						}); | ||||||
| 				} | 				} | ||||||
| 			}) | 			}) | ||||||
| @@ -478,10 +480,12 @@ const internalAccessList = { | |||||||
|  |  | ||||||
| 		return new Promise((resolve, reject) => { | 		return new Promise((resolve, reject) => { | ||||||
| 			let htpasswd_file = internalAccessList.getFilename(list); | 			let htpasswd_file = internalAccessList.getFilename(list); | ||||||
|  | 			let nginx_file = internalAccessList.getFilename(list) + '.conf'; | ||||||
|  |  | ||||||
| 			// 1. remove any existing access file | 			// 1. remove any existing access file | ||||||
| 			try { | 			try { | ||||||
| 				fs.unlinkSync(htpasswd_file); | 				fs.unlinkSync(htpasswd_file); | ||||||
|  | 				fs.unlinkSync(nginx_file); | ||||||
| 			} catch (err) { | 			} catch (err) { | ||||||
| 				// do nothing | 				// do nothing | ||||||
| 			} | 			} | ||||||
|   | |||||||
| @@ -26,6 +26,13 @@ exports.up = function (knex/*, Promise*/) { | |||||||
| 	}) | 	}) | ||||||
| 		.then(function () { | 		.then(function () { | ||||||
| 			logger.info('[' + migrate_name + '] access_list_client Table created'); | 			logger.info('[' + migrate_name + '] access_list_client Table created'); | ||||||
|  |  | ||||||
|  | 			return knex.schema.table('access_list', function (access_list) { | ||||||
|  | 				access_list.integer('satify_any').notNull().defaultTo(0); | ||||||
|  | 			}); | ||||||
|  | 		}) | ||||||
|  | 		.then(() => { | ||||||
|  | 			logger.info('[' + migrate_name + '] access_list Table altered'); | ||||||
| 		}); | 		}); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -27,6 +27,9 @@ | |||||||
|       "type": "string", |       "type": "string", | ||||||
|       "format": "ipv4" |       "format": "ipv4" | ||||||
|     }, |     }, | ||||||
|  |     "satify_any": { | ||||||
|  |       "type": "boolean" | ||||||
|  |     }, | ||||||
|     "meta": { |     "meta": { | ||||||
|       "type": "object" |       "type": "object" | ||||||
|     } |     } | ||||||
| @@ -86,9 +89,12 @@ | |||||||
|           "name": { |           "name": { | ||||||
|             "$ref": "#/definitions/name" |             "$ref": "#/definitions/name" | ||||||
|           }, |           }, | ||||||
|  |           "satify_any": { | ||||||
|  |             "$ref": "#/definitions/satify_any" | ||||||
|  |           }, | ||||||
|           "items": { |           "items": { | ||||||
|             "type": "array", |             "type": "array", | ||||||
|             "minItems": 1, |             "minItems": 0, | ||||||
|             "items": { |             "items": { | ||||||
|               "type": "object", |               "type": "object", | ||||||
|               "additionalProperties": false, |               "additionalProperties": false, | ||||||
| @@ -148,9 +154,12 @@ | |||||||
|           "name": { |           "name": { | ||||||
|             "$ref": "#/definitions/name" |             "$ref": "#/definitions/name" | ||||||
|           }, |           }, | ||||||
|  |           "satify_any": { | ||||||
|  |             "$ref": "#/definitions/satify_any" | ||||||
|  |           }, | ||||||
|           "items": { |           "items": { | ||||||
|             "type": "array", |             "type": "array", | ||||||
|             "minItems": 1, |             "minItems": 0, | ||||||
|             "items": { |             "items": { | ||||||
|               "type": "object", |               "type": "object", | ||||||
|               "additionalProperties": false, |               "additionalProperties": false, | ||||||
|   | |||||||
| @@ -21,6 +21,16 @@ | |||||||
|                                 <input type="text" name="name" class="form-control" value="<%- name %>" required> |                                 <input type="text" name="name" class="form-control" value="<%- name %>" required> | ||||||
|                             </div> |                             </div> | ||||||
|                         </div> |                         </div> | ||||||
|  |  | ||||||
|  |                         <div class="col-sm-6 col-md-6"> | ||||||
|  |                             <div class="form-group"> | ||||||
|  |                                 <label class="custom-switch"> | ||||||
|  |                                     <input type="checkbox" class="custom-switch-input" name="satify_any" value="1"<%- typeof satify_any !== 'undefined' && satify_any ? ' checked' : '' %>> | ||||||
|  |                                     <span class="custom-switch-indicator"></span> | ||||||
|  |                                     <span class="custom-switch-description"><%- i18n('access-lists', 'satisfy-any') %></span> | ||||||
|  |                                 </label> | ||||||
|  |                             </div> | ||||||
|  |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|                 </div> |                 </div> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -65,17 +65,20 @@ module.exports = Mn.View.extend({ | |||||||
|                 } |                 } | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
|             if (!items_data.length) { |             if (!items_data.length && !clients_data.length) { | ||||||
|                 alert('You must specify at least 1 Username and Password combination'); |                 alert('You must specify at least 1 Authorization or Access rule'); | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             let data = { |             let data = { | ||||||
|                 name:    form_data.name, |                 name:       form_data.name, | ||||||
|                 items:   items_data, |                 satify_any: !!form_data.satify_any, | ||||||
|                 clients: clients_data |                 items:      items_data, | ||||||
|  |                 clients:    clients_data | ||||||
|             }; |             }; | ||||||
|  |  | ||||||
|  |             console.log(data); | ||||||
|  |  | ||||||
|             let method = App.Api.Nginx.AccessLists.create; |             let method = App.Api.Nginx.AccessLists.create; | ||||||
|             let is_new = true; |             let is_new = true; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -17,6 +17,13 @@ | |||||||
| <td> | <td> | ||||||
|     <%- i18n('access-lists', 'client-count', {count: clients.length || 0}) %> |     <%- i18n('access-lists', 'client-count', {count: clients.length || 0}) %> | ||||||
| </td> | </td> | ||||||
|  | <td> | ||||||
|  |     <% if (satify_any) { %> | ||||||
|  |     <%- i18n('str', 'any') %> | ||||||
|  |     <%} else { %> | ||||||
|  |     <%- i18n('str', 'all') %> | ||||||
|  |     <% } %> | ||||||
|  | </td> | ||||||
| <td> | <td> | ||||||
|     <%- i18n('access-lists', 'proxy-host-count', {count: proxy_host_count}) %> |     <%- i18n('access-lists', 'proxy-host-count', {count: proxy_host_count}) %> | ||||||
| </td> | </td> | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
|     <th><%- i18n('str', 'name') %></th> |     <th><%- i18n('str', 'name') %></th> | ||||||
|     <th><%- i18n('access-lists', 'authorization') %></th> |     <th><%- i18n('access-lists', 'authorization') %></th> | ||||||
|     <th><%- i18n('access-lists', 'access') %></th> |     <th><%- i18n('access-lists', 'access') %></th> | ||||||
|  |     <th><%- i18n('access-lists', 'satisfy') %></th> | ||||||
|     <th><%- i18n('proxy-hosts', 'title') %></th> |     <th><%- i18n('proxy-hosts', 'title') %></th> | ||||||
|     <% if (canManage) { %> |     <% if (canManage) { %> | ||||||
|     <th> </th> |     <th> </th> | ||||||
|   | |||||||
| @@ -33,7 +33,9 @@ | |||||||
|       "unknown": "Unknown", |       "unknown": "Unknown", | ||||||
|       "expires": "Expires", |       "expires": "Expires", | ||||||
|       "value": "Value", |       "value": "Value", | ||||||
|       "please-wait": "Please wait..." |       "please-wait": "Please wait...", | ||||||
|  |       "all": "All", | ||||||
|  |       "any": "Any" | ||||||
|     }, |     }, | ||||||
|     "login": { |     "login": { | ||||||
|       "title": "Login to your account" |       "title": "Login to your account" | ||||||
| @@ -191,7 +193,9 @@ | |||||||
|       "delete-has-hosts": "This Access List is associated with {count} Proxy Hosts. They will become publicly available upon deletion.", |       "delete-has-hosts": "This Access List is associated with {count} Proxy Hosts. They will become publicly available upon deletion.", | ||||||
|       "details": "Details", |       "details": "Details", | ||||||
|       "authorization": "Authorization", |       "authorization": "Authorization", | ||||||
|       "access": "Access" |       "access": "Access", | ||||||
|  |       "satisfy": "Satisfy", | ||||||
|  |       "satisfy-any": "Satify Any" | ||||||
|     }, |     }, | ||||||
|     "users": { |     "users": { | ||||||
|       "title": "Users", |       "title": "Users", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user