mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
virtual folders: change dataprovider structure
This way we no longer depend on the local file system path and so we can add support for cloud backends in future updates
This commit is contained in:
@@ -13,7 +13,8 @@ import (
|
||||
// quota limits or a different virtual path.
|
||||
type BaseVirtualFolder struct {
|
||||
ID int64 `json:"id"`
|
||||
MappedPath string `json:"mapped_path"`
|
||||
Name string `json:"name"`
|
||||
MappedPath string `json:"mapped_path,omitempty"`
|
||||
UsedQuotaSize int64 `json:"used_quota_size"`
|
||||
// Used quota as number of files
|
||||
UsedQuotaFiles int `json:"used_quota_files"`
|
||||
@@ -23,6 +24,21 @@ type BaseVirtualFolder struct {
|
||||
Users []string `json:"users,omitempty"`
|
||||
}
|
||||
|
||||
// GetACopy returns a copy
|
||||
func (v *BaseVirtualFolder) GetACopy() BaseVirtualFolder {
|
||||
users := make([]string, len(v.Users))
|
||||
copy(users, v.Users)
|
||||
return BaseVirtualFolder{
|
||||
ID: v.ID,
|
||||
Name: v.Name,
|
||||
MappedPath: v.MappedPath,
|
||||
UsedQuotaSize: v.UsedQuotaSize,
|
||||
UsedQuotaFiles: v.UsedQuotaFiles,
|
||||
LastQuotaUpdate: v.LastQuotaUpdate,
|
||||
Users: users,
|
||||
}
|
||||
}
|
||||
|
||||
// GetUsersAsString returns the list of users as comma separated string
|
||||
func (v *BaseVirtualFolder) GetUsersAsString() string {
|
||||
return strings.Join(v.Users, ",")
|
||||
|
||||
Reference in New Issue
Block a user