mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 23:28:39 +03:00
eventmanager: add support for filesystem actions
Fixes #931 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -52,6 +52,10 @@ const (
|
||||
actionObjectEventRule = "event_rule"
|
||||
)
|
||||
|
||||
var (
|
||||
actionsConcurrencyGuard = make(chan struct{}, 100)
|
||||
)
|
||||
|
||||
func executeAction(operation, executor, ip, objectType, objectName string, object plugin.Renderer) {
|
||||
if plugin.Handler.HasNotifiers() {
|
||||
plugin.Handler.NotifyProviderEvent(¬ifier.ProviderEvent{
|
||||
@@ -75,6 +79,11 @@ func executeAction(operation, executor, ip, objectType, objectName string, objec
|
||||
}
|
||||
|
||||
go func() {
|
||||
actionsConcurrencyGuard <- struct{}{}
|
||||
defer func() {
|
||||
<-actionsConcurrencyGuard
|
||||
}()
|
||||
|
||||
dataAsJSON, err := object.RenderAsJSON(operation != operationDelete)
|
||||
if err != nil {
|
||||
providerLog(logger.LevelError, "unable to serialize user as JSON for operation %#v: %v", operation, err)
|
||||
|
||||
Reference in New Issue
Block a user