diff options
author | Ted Trask <ttrask01@yahoo.com> | 2012-05-08 18:12:59 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2012-05-08 18:14:18 +0000 |
commit | 2c68efba02e44d42a031a153da5baa7e6e9a2d87 (patch) | |
tree | cfd6767e2b3de1701f37d8e2b323a0c0df49e7df | |
parent | 3eb1b515c39d4e76b8fdaf7d64cb9f4b698a0743 (diff) | |
download | acf-core-2c68efba02e44d42a031a153da5baa7e6e9a2d87.tar.bz2 acf-core-2c68efba02e44d42a031a153da5baa7e6e9a2d87.tar.xz |
Proper fix for bug 1131
(cherry picked from commit 0f891d4bba7dbde1ef2a336ec6be9950d95b57a0)
-rw-r--r-- | lib/authenticator.lua | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/lib/authenticator.lua b/lib/authenticator.lua index 473ddc0..4ce2300 100644 --- a/lib/authenticator.lua +++ b/lib/authenticator.lua @@ -109,25 +109,6 @@ local mksalt = function() return "$6$"..str.."$" end -local duplicatestructure -duplicatestructure = function(value, saved) - saved = saved or {} - if type(value) == "table" then - if saved[value] then - return saved[value] - else - local output = {} - saved[value] = output - for k,v in pairs(value) do - output[k] = duplicatestructure(v, saved) - end - return output - end - else - return value - end -end - --- public methods -- This function returns true or false, and @@ -187,7 +168,20 @@ write_userinfo = function(self, userinfo) get_id(self, id.userid) if success and self.sessiondata and self.sessiondata.userinfo and self.sessiondata.userinfo.userid == id.userid then - self.sessiondata.userinfo = duplicatestructure(id) + self.sessiondata.userinfo = {} + for name,value in pairs(id) do + if name == "roles" then + if value == "" then + value = "GUEST" + else + value = value..",GUEST" + end + self.sessiondata.userinfo.roles = format.string_to_table(value, "%s*,%s*") + else + self.sessiondata.userinfo[name] = value + end + end +self.logevent(session.serialize("userinfo", self.sessiondata.userinfo)) end return success |