summaryrefslogtreecommitdiffstats
path: root/lib/authenticator.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2012-05-08 18:12:59 +0000
committerTed Trask <ttrask01@yahoo.com>2012-05-08 18:12:59 +0000
commit0f891d4bba7dbde1ef2a336ec6be9950d95b57a0 (patch)
treefbfa408d2f54a71a0f0666c62887cf2ec327224d /lib/authenticator.lua
parentb4b3d4ced53fb6c19addde2237177b3a56f48733 (diff)
downloadacf-core-0f891d4bba7dbde1ef2a336ec6be9950d95b57a0.tar.bz2
acf-core-0f891d4bba7dbde1ef2a336ec6be9950d95b57a0.tar.xz
Proper fix for bug 1131
Diffstat (limited to 'lib/authenticator.lua')
-rw-r--r--lib/authenticator.lua34
1 files changed, 14 insertions, 20 deletions
diff --git a/lib/authenticator.lua b/lib/authenticator.lua
index db4d3f7..161216e 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