mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-11-20 02:18:20 +01:00
27 lines
490 B
Lua
27 lines
490 B
Lua
|
local uman={}
|
||
|
|
||
|
uman.userinfo = function(user)
|
||
|
local info = {}
|
||
|
local uid = ulib.uid(user)
|
||
|
if uid then
|
||
|
-- read the setting
|
||
|
-- use the decodeFile function of JSON instead
|
||
|
local file = require('vfs').ospath("home:///").."/.settings.json"
|
||
|
local st = JSON.decodeFile(file)
|
||
|
if(st) then
|
||
|
info = st
|
||
|
end
|
||
|
info.user = {
|
||
|
username = user,
|
||
|
id = uid.id,
|
||
|
name = user,
|
||
|
groups = uid.groups
|
||
|
}
|
||
|
--print(JSON.encode(info))
|
||
|
return info
|
||
|
else
|
||
|
return {}
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return uman
|