mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 23:28:39 +03:00
Admin UI: allow to create multiple users/folders from templates
the clone button is not needed anymore, you can select a user and click on template to generate one or more similar users or you can create users/folders from an empty template Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -344,16 +344,10 @@ func (u *User) IsTLSUsernameVerificationEnabled() bool {
|
||||
|
||||
// SetEmptySecrets sets to empty any user secret
|
||||
func (u *User) SetEmptySecrets() {
|
||||
u.FsConfig.S3Config.AccessSecret = kms.NewEmptySecret()
|
||||
u.FsConfig.GCSConfig.Credentials = kms.NewEmptySecret()
|
||||
u.FsConfig.AzBlobConfig.AccountKey = kms.NewEmptySecret()
|
||||
u.FsConfig.AzBlobConfig.SASURL = kms.NewEmptySecret()
|
||||
u.FsConfig.CryptConfig.Passphrase = kms.NewEmptySecret()
|
||||
u.FsConfig.SFTPConfig.Password = kms.NewEmptySecret()
|
||||
u.FsConfig.SFTPConfig.PrivateKey = kms.NewEmptySecret()
|
||||
u.FsConfig.SetEmptySecrets()
|
||||
for idx := range u.VirtualFolders {
|
||||
folder := &u.VirtualFolders[idx]
|
||||
folder.FsConfig.SetEmptySecretsIfNil()
|
||||
folder.FsConfig.SetEmptySecrets()
|
||||
}
|
||||
u.Filters.TOTPConfig.Secret = kms.NewEmptySecret()
|
||||
}
|
||||
@@ -572,6 +566,9 @@ func (u *User) AddVirtualDirs(list []os.FileInfo, virtualPath string) []os.FileI
|
||||
for index := range list {
|
||||
for dir := range vdirs {
|
||||
if list[index].Name() == dir {
|
||||
if !list[index].IsDir() {
|
||||
list[index] = vfs.NewFileInfo(dir, true, 0, time.Now(), false)
|
||||
}
|
||||
delete(vdirs, dir)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user