Page 1 of 2

Event management at a user level

Posted: Fri Sep 07, 2012 12:02 pm
by webturtles
Hi

Would it be possible to add events/triggers at a user rather than a domain level? Maybe have another tab under edit user, which would allow you to add one of more event rules, maybe even allow one rule to be spread over multiple events (upload by ftp,http,ssh - fire rule 1.....)

Chris

Re: Event management at a user level

Posted: Sun Sep 09, 2012 4:51 pm
by FTP
If you want to handle some complex event, you can write Lua script like this:

Code: Select all

if "%Name" == "aa" then
    c_SendMail("aa@gmail.com","a file has been uploaded","%Name uploaded %PathName","","SMTP_CONFIG")
elseif "%Name" == "bb" then
    c_SendMail("bb@gmail.com","a file has been uploaded","%Name uploaded %PathName","","SMTP_CONFIG")
end

Re: Event management at a user level

Posted: Wed Sep 12, 2012 11:24 am
by webturtles
Hi

I know you could that, but that approach will get unwieldly in time when you have lots of users etc.

Chris

Re: Event management at a user level

Posted: Thu Sep 13, 2012 2:43 pm
by FTP
Currently WingFTP only can do such thing, what's your detailed requirement?

Re: Event management at a user level

Posted: Wed Sep 19, 2012 3:12 pm
by webturtles
Hi

I was just thinking about how dealing with these rules could be improved. At the moment you have to open each of the events you want script seperately and put conditional statements in for each user.

It would make sense to control event scripting etc by each user - so you could just look at an event managment tab on the user window and say add an event like email me a message and be able to select one or more event listeners - like ftp file uploads and http file uploads. It then makes it clearer to audit the events attached to each user (rather than unpicking http upload event lua code for multiple users then doing the same for ftp upload lua code etc.

Thanks
Chris

Re: Event management at a user level

Posted: Sat Sep 22, 2012 6:37 am
by FTP
Yes, I know event for each account can be managed easily, but we have no plan to add such feature for the current version, and for your requirement, I will provide you another good solution:

1. Put the email address into "User -> Notes -> Email address" for the user account who want to be notified.

2. Add the following Lua script into the event "OnFileUploaded":

Code: Select all

local user = c_GetUser("%Domain","%Name")   
local user_email = user.note_email 
if user_email ~= nil and user_email ~= "" then 
	c_SendMail(user_email,"a file has been uploaded","%Name uploaded into %PathName","","SMTP_CONFIG") 
end

Re: Event management at a user level

Posted: Tue Oct 23, 2012 2:40 pm
by webturtles
Hi

A bit late in the day I know, but thanks for the code - very useful.

Cheers
Chris

Re: Event management at a user level

Posted: Wed May 29, 2013 1:41 pm
by SpiderMike
FTP wrote:Yes, I know event for each account can be managed easily, but we have no plan to add such feature for the current version, and for your requirement, I will provide you another good solution:

1. Put the email address into "User -> Notes -> Email address" for the user account who want to be notified.

2. Add the following Lua script into the event "OnFileUploaded":

Code: Select all

local user = c_GetUser("%Domain","%Name")   
local user_email = user.note_email 
if user_email ~= nil and user_email ~= "" then 
	c_SendMail(user_email,"a file has been uploaded","%Name uploaded into %PathName","","SMTP_CONFIG") 
end
Hey,

can you give me an complete example? I don`t know what you mean with ~ or nil ..
Sorry, today is my first day with Wing FTP.

I tried out, but it does`t work

Code: Select all

 local user = c_GetUser("%Domain","%Name")   
local user_email = user.note_email 
if user_email ~= nil and user_email ~= "" then 
	c_SendMail(user_email,"a file has been uploaded","%Name uploaded into %PathName","","FTP-Server") 
end
Thanks

Re: Event management at a user level

Posted: Sat Jun 01, 2013 2:53 am
by FTP
What you need to do is just replace this string "SMTP_CONFIG" into your own SMTP configuration name.

Re: Event management at a user level

Posted: Thu Sep 13, 2018 6:46 pm
by seattle
FTP wrote:Yes, I know event for each account can be managed easily, but we have no plan to add such feature for the current version, {...}
it would be really helpful to get event management per user going.