diff options
-rw-r--r-- | openldap-controller.lua | 2 | ||||
-rw-r--r-- | openldap-model.lua | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/openldap-controller.lua b/openldap-controller.lua index 3e63f70..00b9f2e 100644 --- a/openldap-controller.lua +++ b/openldap-controller.lua @@ -17,7 +17,7 @@ mymodule.expert = function(self) end mymodule.search = function(self) - return self.handle_form(self, self.model.get_ldapsearch, self.model.get_ldapsearch, "Search", "Search Again") + return self.model.get_ldapsearch(self) end return mymodule diff --git a/openldap-model.lua b/openldap-model.lua index 5c525a4..38b70bd 100644 --- a/openldap-model.lua +++ b/openldap-model.lua @@ -26,7 +26,7 @@ function mymodule.update_filecontent(self, filedetails) return modelfunctions.setfiledetails(self, filedetails, {configfile}) end -function mymodule.get_ldapsearch(self, ldapdata) +function mymodule.get_ldapsearch(self) local cnf = mymodule.parse_config(configfile) local result = {} @@ -34,11 +34,13 @@ function mymodule.get_ldapsearch(self, ldapdata) local handle = io.popen(cmd) local file = handle:read("*a") - result.dn = cfe({type="longtext", label="DNs"}) result.suffix = cfe({label="Suffix"}) result.suffix.value = cnf.suffix or "" result.suffix.readonly = true - + result.suffix.seq = 1 + result.dn = cfe({type="longtext", label="DNs"}) + result.dn.seq = 2 + for line in string.gmatch(file, "[^\n]+") do if string.match(line, "^dn") then result.dn.value = result.dn.value .."\n"..string.match(line, "dn: (.*)") |