mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 14:20:55 +03:00
remove some useless hooks
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -236,20 +236,8 @@ var (
|
||||
fnReloadRules FnReloadRules
|
||||
fnRemoveRule FnRemoveRule
|
||||
fnHandleRuleForProviderEvent FnHandleRuleForProviderEvent
|
||||
fnCanSetHomeDir func() bool
|
||||
fnPreUserValidation func(u *User)
|
||||
fnPreFolderValidation func(f *vfs.BaseVirtualFolder)
|
||||
fnPreGroupValidation func(g *Group)
|
||||
)
|
||||
|
||||
// CanSetHomeDir returns true if the home directory can be changed
|
||||
func CanSetHomeDir() bool {
|
||||
if fnCanSetHomeDir != nil {
|
||||
return fnCanSetHomeDir()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func initSQLTables() {
|
||||
sqlTableUsers = "users"
|
||||
sqlTableFolders = "folders"
|
||||
@@ -3334,9 +3322,6 @@ func createUserPasswordHash(user *User) error {
|
||||
// FIXME: this should be defined as Folder struct method
|
||||
func ValidateFolder(folder *vfs.BaseVirtualFolder) error {
|
||||
folder.FsConfig.SetEmptySecretsIfNil()
|
||||
if fnPreFolderValidation != nil {
|
||||
fnPreFolderValidation(folder)
|
||||
}
|
||||
if folder.Name == "" {
|
||||
return util.NewI18nError(util.NewValidationError("folder name is mandatory"), util.I18nErrorNameRequired)
|
||||
}
|
||||
@@ -3369,9 +3354,6 @@ func ValidateUser(user *User) error {
|
||||
user.OIDCCustomFields = nil
|
||||
user.HasPassword = false
|
||||
user.SetEmptySecretsIfNil()
|
||||
if fnPreUserValidation != nil {
|
||||
fnPreUserValidation(user)
|
||||
}
|
||||
buildUserHomeDir(user)
|
||||
if err := validateBaseParams(user); err != nil {
|
||||
return err
|
||||
|
||||
@@ -134,9 +134,6 @@ func (g *Group) hasRedactedSecret() bool {
|
||||
|
||||
func (g *Group) validate() error {
|
||||
g.SetEmptySecretsIfNil()
|
||||
if fnPreGroupValidation != nil {
|
||||
fnPreGroupValidation(g)
|
||||
}
|
||||
if g.Name == "" {
|
||||
return util.NewI18nError(util.NewValidationError("name is mandatory"), util.I18nErrorNameRequired)
|
||||
}
|
||||
|
||||
@@ -157,9 +157,6 @@ func (u *User) GetFilesystem(connectionID string) (fs vfs.Fs, err error) {
|
||||
}
|
||||
|
||||
func (u *User) getRootFs(connectionID string) (fs vfs.Fs, err error) {
|
||||
if vfs.IsFsDisabled(u.FsConfig.Provider) {
|
||||
return nil, fmt.Errorf("filesystem provider %d is disabled", u.FsConfig.Provider)
|
||||
}
|
||||
switch u.FsConfig.Provider {
|
||||
case sdk.S3FilesystemProvider:
|
||||
return vfs.NewS3Fs(connectionID, u.GetHomeDir(), "", u.FsConfig.S3Config)
|
||||
|
||||
Reference in New Issue
Block a user