mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Add option to prevent LDAP from deactivating everything on empty search (#9879)
* Add option to prevent LDAP from deactivating everything on empty search * Update options/locale/locale_en-US.ini Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -61,6 +61,10 @@ var (
 | 
			
		||||
			Name:  "admin-filter",
 | 
			
		||||
			Usage: "An LDAP filter specifying if a user should be given administrator privileges.",
 | 
			
		||||
		},
 | 
			
		||||
		cli.BoolFlag{
 | 
			
		||||
			Name:  "allow-deactivate-all",
 | 
			
		||||
			Usage: "Allow empty search results to deactivate all users.",
 | 
			
		||||
		},
 | 
			
		||||
		cli.StringFlag{
 | 
			
		||||
			Name:  "username-attribute",
 | 
			
		||||
			Usage: "The attribute of the user’s LDAP record containing the user name.",
 | 
			
		||||
@@ -231,6 +235,9 @@ func parseLdapConfig(c *cli.Context, config *models.LDAPConfig) error {
 | 
			
		||||
	if c.IsSet("admin-filter") {
 | 
			
		||||
		config.Source.AdminFilter = c.String("admin-filter")
 | 
			
		||||
	}
 | 
			
		||||
	if c.IsSet("allow-deactivate-all") {
 | 
			
		||||
		config.Source.AllowDeactivateAll = c.Bool("allow-deactivate-all")
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user