Event management at a user level

Post here if you have some suggestions or you want to request a new feature.
webturtles
Posts: 20
Joined: Fri Dec 11, 2009 10:34 pm

Event management at a user level

Post 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
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Event management at a user level

Post 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
webturtles
Posts: 20
Joined: Fri Dec 11, 2009 10:34 pm

Re: Event management at a user level

Post by webturtles »

Hi

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

Chris
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Event management at a user level

Post by FTP »

Currently WingFTP only can do such thing, what's your detailed requirement?
webturtles
Posts: 20
Joined: Fri Dec 11, 2009 10:34 pm

Re: Event management at a user level

Post 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
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Event management at a user level

Post 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
webturtles
Posts: 20
Joined: Fri Dec 11, 2009 10:34 pm

Re: Event management at a user level

Post by webturtles »

Hi

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

Cheers
Chris
SpiderMike
Posts: 1
Joined: Wed May 29, 2013 12:32 pm

Re: Event management at a user level

Post 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
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Event management at a user level

Post by FTP »

What you need to do is just replace this string "SMTP_CONFIG" into your own SMTP configuration name.
seattle
Posts: 28
Joined: Tue Nov 07, 2017 7:31 pm

Re: Event management at a user level

Post 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.
Post Reply