Comparison

plugins/mod_auth_ldap.lua @ 13224:71c28b36923f

mod_auth_ldap: Use enum option method
author Kim Alvefur <zash@zash.se>
date Tue, 18 Jul 2023 12:31:29 +0200
parent 12977:74b9e05af71e
comparison
equal deleted inserted replaced
13223:b88b3e414550 13224:71c28b36923f
10 -- Config options 10 -- Config options
11 local ldap_server = module:get_option_string("ldap_server", "localhost"); 11 local ldap_server = module:get_option_string("ldap_server", "localhost");
12 local ldap_rootdn = module:get_option_string("ldap_rootdn", ""); 12 local ldap_rootdn = module:get_option_string("ldap_rootdn", "");
13 local ldap_password = module:get_option_string("ldap_password", ""); 13 local ldap_password = module:get_option_string("ldap_password", "");
14 local ldap_tls = module:get_option_boolean("ldap_tls"); 14 local ldap_tls = module:get_option_boolean("ldap_tls");
15 local ldap_scope = module:get_option_string("ldap_scope", "subtree"); 15 local ldap_scope = module:get_option_enum("ldap_scope", "subtree", "base", "onelevel");
16 local ldap_filter = module:get_option_string("ldap_filter", "(uid=$user)"):gsub("%%s", "$user", 1); 16 local ldap_filter = module:get_option_string("ldap_filter", "(uid=$user)"):gsub("%%s", "$user", 1);
17 local ldap_base = assert(module:get_option_string("ldap_base"), "ldap_base is a required option for ldap"); 17 local ldap_base = assert(module:get_option_string("ldap_base"), "ldap_base is a required option for ldap");
18 local ldap_mode = module:get_option_string("ldap_mode", "bind"); 18 local ldap_mode = module:get_option_enum("ldap_mode", "bind", "getpasswd");
19 local ldap_admins = module:get_option_string("ldap_admin_filter", 19 local ldap_admins = module:get_option_string("ldap_admin_filter",
20 module:get_option_string("ldap_admins")); -- COMPAT with mistake in documentation 20 module:get_option_string("ldap_admins")); -- COMPAT with mistake in documentation
21 local host = ldap_filter_escape(module:get_option_string("realm", module.host)); 21 local host = ldap_filter_escape(module:get_option_string("realm", module.host));
22 22
23 if ldap_admins then 23 if ldap_admins then