Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
add filetransfer lock.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k1o committed Apr 20, 2024
1 parent a61eade commit 3ee6078
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/plugins/filetransfer/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ func (m *Manager) isEnabledForSession(session types.Session) bool {
}
}

settings, ok := m.sessions.Settings().Plugins["filetransfer"]
// by default, allow file transfer if the plugin config is not present
if ok && canTransfer && session.Profile().IsAdmin {
canTransfer, ok = settings.(bool)
// if the plugin is present but not a boolean, allow file transfer
if !ok {
canTransfer = true
}
}

return m.config.Enabled && canTransfer
// TODO: when locking is implemented
// && (session.Profile().IsAdmin || !h.state.IsLocked("file_transfer"))
}

func (m *Manager) refresh() (error, bool) {
Expand Down

0 comments on commit 3ee6078

Please sign in to comment.