getting group logged in user belongs to
-
- Posts: 31
- Joined: Tue Nov 07, 2017 7:31 pm
getting group logged in user belongs to
looking for a way that will work with the current version of getting the groups that the current user belongs to so that i can use then in a LUA script to send emails based on the group name.
-
- Site Admin
- Posts: 2082
- Joined: Tue Sep 29, 2009 6:09 am
Re: getting group logged in user belongs to
OK, maybe you can get all the group names via Lua script:
Code: Select all
local user = c_GetUser("DomainName", "UserName")
local grouplist = user["usergroups"]
if grouplist ~= nil then
for _,group in pairs(grouplist) do
print(group.groupname.."\n")
end
end
-
- Posts: 31
- Joined: Tue Nov 07, 2017 7:31 pm
Re: getting group logged in user belongs to
getting Failed to execute lua script of event OnUserDisconnect with the following- oops wrong line, never mind the error
gives a result without the value of groupname :
Code: Select all
local user = c_GetUser("%Domain","%Name")
local grouplist = user["usergroups"]
if grouplist ~= nil then
for _,group in pairs(grouplist) do
myfile=io.open("d://ftpusers//test.txt","a")
io.output(myfile)
io.write("ssh, %Name, %IP, group.groupname.. \n")
io.close(myfile)
end
end
ssh, courteke, 192.168.123.243, group.groupname..
-
- Site Admin
- Posts: 2082
- Joined: Tue Sep 29, 2009 6:09 am
Re: getting group logged in user belongs to
You can try such Lua script:
Code: Select all
io.write("ssh, %Name, %IP, "..group.groupname.."\n")