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()) | ||||
| 					.insertAndFetch({ | ||||
| 						name:          data.name, | ||||
| 						satify_any:    data.satify_any, | ||||
| 						owner_user_id: access.token.getUserId(1) | ||||
| 					}); | ||||
| 			}) | ||||
| @@ -125,7 +126,8 @@ const internalAccessList = { | ||||
| 						.query() | ||||
| 						.where({id: data.id}) | ||||
| 						.patch({ | ||||
| 							name: data.name | ||||
| 							name:       data.name, | ||||
| 							satify_any: data.satify_any, | ||||
| 						}); | ||||
| 				} | ||||
| 			}) | ||||
| @@ -478,10 +480,12 @@ const internalAccessList = { | ||||
|  | ||||
| 		return new Promise((resolve, reject) => { | ||||
| 			let htpasswd_file = internalAccessList.getFilename(list); | ||||
| 			let nginx_file = internalAccessList.getFilename(list) + '.conf'; | ||||
|  | ||||
| 			// 1. remove any existing access file | ||||
| 			try { | ||||
| 				fs.unlinkSync(htpasswd_file); | ||||
| 				fs.unlinkSync(nginx_file); | ||||
| 			} catch (err) { | ||||
| 				// do nothing | ||||
| 			} | ||||
|   | ||||
| @@ -26,6 +26,13 @@ exports.up = function (knex/*, Promise*/) { | ||||
| 	}) | ||||
| 		.then(function () { | ||||
| 			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", | ||||
|       "format": "ipv4" | ||||
|     }, | ||||
|     "satify_any": { | ||||
|       "type": "boolean" | ||||
|     }, | ||||
|     "meta": { | ||||
|       "type": "object" | ||||
|     } | ||||
| @@ -86,9 +89,12 @@ | ||||
|           "name": { | ||||
|             "$ref": "#/definitions/name" | ||||
|           }, | ||||
|           "satify_any": { | ||||
|             "$ref": "#/definitions/satify_any" | ||||
|           }, | ||||
|           "items": { | ||||
|             "type": "array", | ||||
|             "minItems": 1, | ||||
|             "minItems": 0, | ||||
|             "items": { | ||||
|               "type": "object", | ||||
|               "additionalProperties": false, | ||||
| @@ -148,9 +154,12 @@ | ||||
|           "name": { | ||||
|             "$ref": "#/definitions/name" | ||||
|           }, | ||||
|           "satify_any": { | ||||
|             "$ref": "#/definitions/satify_any" | ||||
|           }, | ||||
|           "items": { | ||||
|             "type": "array", | ||||
|             "minItems": 1, | ||||
|             "minItems": 0, | ||||
|             "items": { | ||||
|               "type": "object", | ||||
|               "additionalProperties": false, | ||||
|   | ||||
| @@ -21,6 +21,16 @@ | ||||
|                                 <input type="text" name="name" class="form-control" value="<%- name %>" required> | ||||
|                             </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> | ||||
|  | ||||
|   | ||||
| @@ -65,17 +65,20 @@ module.exports = Mn.View.extend({ | ||||
|                 } | ||||
|             }); | ||||
|  | ||||
|             if (!items_data.length) { | ||||
|                 alert('You must specify at least 1 Username and Password combination'); | ||||
|             if (!items_data.length && !clients_data.length) { | ||||
|                 alert('You must specify at least 1 Authorization or Access rule'); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             let data = { | ||||
|                 name:    form_data.name, | ||||
|                 items:   items_data, | ||||
|                 clients: clients_data | ||||
|                 name:       form_data.name, | ||||
|                 satify_any: !!form_data.satify_any, | ||||
|                 items:      items_data, | ||||
|                 clients:    clients_data | ||||
|             }; | ||||
|  | ||||
|             console.log(data); | ||||
|  | ||||
|             let method = App.Api.Nginx.AccessLists.create; | ||||
|             let is_new = true; | ||||
|  | ||||
|   | ||||
| @@ -17,6 +17,13 @@ | ||||
| <td> | ||||
|     <%- i18n('access-lists', 'client-count', {count: clients.length || 0}) %> | ||||
| </td> | ||||
| <td> | ||||
|     <% if (satify_any) { %> | ||||
|     <%- i18n('str', 'any') %> | ||||
|     <%} else { %> | ||||
|     <%- i18n('str', 'all') %> | ||||
|     <% } %> | ||||
| </td> | ||||
| <td> | ||||
|     <%- i18n('access-lists', 'proxy-host-count', {count: proxy_host_count}) %> | ||||
| </td> | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
|     <th><%- i18n('str', 'name') %></th> | ||||
|     <th><%- i18n('access-lists', 'authorization') %></th> | ||||
|     <th><%- i18n('access-lists', 'access') %></th> | ||||
|     <th><%- i18n('access-lists', 'satisfy') %></th> | ||||
|     <th><%- i18n('proxy-hosts', 'title') %></th> | ||||
|     <% if (canManage) { %> | ||||
|     <th> </th> | ||||
|   | ||||
| @@ -33,7 +33,9 @@ | ||||
|       "unknown": "Unknown", | ||||
|       "expires": "Expires", | ||||
|       "value": "Value", | ||||
|       "please-wait": "Please wait..." | ||||
|       "please-wait": "Please wait...", | ||||
|       "all": "All", | ||||
|       "any": "Any" | ||||
|     }, | ||||
|     "login": { | ||||
|       "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.", | ||||
|       "details": "Details", | ||||
|       "authorization": "Authorization", | ||||
|       "access": "Access" | ||||
|       "access": "Access", | ||||
|       "satisfy": "Satisfy", | ||||
|       "satisfy-any": "Satify Any" | ||||
|     }, | ||||
|     "users": { | ||||
|       "title": "Users", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user