diff options
-rw-r--r-- | app/acf_www-controller.lua | 2 | ||||
-rwxr-xr-x | www/cgi-bin/mvc.lua | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua index 0dfbea7..2a54620 100644 --- a/app/acf_www-controller.lua +++ b/app/acf_www-controller.lua @@ -69,6 +69,7 @@ mvc.on_load = function (self, parent) self.conf.libdir = self.conf.libdir or ( self.conf.appdir .. "/lib/" ) self.conf.sessiondir = self.conf.sessiondir or "/tmp/" self.conf.appuri = "https://" .. ENV.HTTP_HOST .. ENV.SCRIPT_NAME + self.conf.default_prefix = "/" self.conf.default_controller = "welcome" self.conf.default_action = "read" self.clientdata = FORM @@ -135,7 +136,6 @@ end mvc.post_exec = function (self) sessionlib=require ("session") - -- sessionlib.serialize("s", sessiondata)) if sessiondata.id then sessionlib.save_session(conf.sessiondir, sessiondata) end diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua index 2b7c8b4..1fa88da 100755 --- a/www/cgi-bin/mvc.lua +++ b/www/cgi-bin/mvc.lua @@ -115,21 +115,24 @@ dispatch = function (self, userprefix, userctlr, useraction) local controller = nil local action = "" self.conf.default_controller = self.conf.default_controller or "" + self.conf.default_prefix = self.conf.default_prefix or "" if "" == self.conf.controller then + self.conf.prefix = self.conf.default_prefix self.conf.controller = self.conf.default_controller self.conf.action = "" end while "" ~= self.conf.controller do -- We now know the controller / action combo, check if we're allowed to do it local perm = true + local worker_loaded = false if type(self.worker.mvc.check_permission) == "function" then perm = self.worker.mvc.check_permission(self, self.conf.controller) end if perm then - controller = self:new(self.conf.prefix .. self.conf.controller) + controller, worker_loaded = self:new(self.conf.prefix .. self.conf.controller) end - if controller then + if worker_loaded then controller.conf.default_action = controller.conf.default_action or "" action = controller.conf.action or "" if "" == action then @@ -161,6 +164,7 @@ dispatch = function (self, userprefix, userctlr, useraction) controller = nil self.conf.action = "" if self.conf.controller ~= self.conf.default_controller then + self.conf.prefix = self.conf.default_prefix self.conf.controller = self.conf.default_controller else self.conf.controller = "" |