Page 1 of 1

getting group logged in user belongs to

Posted: Wed Sep 12, 2018 9:16 pm
by seattle
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.

Re: getting group logged in user belongs to

Posted: Thu Sep 13, 2018 12:39 pm
by FTP
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

Re: getting group logged in user belongs to

Posted: Thu Sep 13, 2018 6:05 pm
by seattle
getting Failed to execute lua script of event OnUserDisconnect with the following- oops wrong line, never mind the error

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
gives a result without the value of groupname :
ssh, courteke, 192.168.123.243, group.groupname..

Re: getting group logged in user belongs to

Posted: Mon Sep 17, 2018 12:16 pm
by FTP
You can try such Lua script:

Code: Select all

io.write("ssh, %Name,  %IP, "..group.groupname.."\n")