fix: isolate admin WebDAV path by username
This commit is contained in:
+3
-2
@@ -21,7 +21,7 @@ func cleanWebDAVRoot(root string) string {
|
|||||||
|
|
||||||
func (a *App) initializeUserWebDAVDefaults() error {
|
func (a *App) initializeUserWebDAVDefaults() error {
|
||||||
var users []User
|
var users []User
|
||||||
if err := a.db.Where("role <> ?", RoleAdmin).Find(&users).Error; err != nil {
|
if err := a.db.Find(&users).Error; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
@@ -127,5 +127,6 @@ func (a *App) storageForTask(t *Task) (RemoteStorage, string, bool) {
|
|||||||
if a.db.Where("user_id = ?", user.ID).First(&cfg).Error == nil && cfg.RootPath != "" {
|
if a.db.Where("user_id = ?", user.ID).First(&cfg).Error == nil && cfg.RootPath != "" {
|
||||||
return a.storage, cfg.RootPath, true
|
return a.storage, cfg.RootPath, true
|
||||||
}
|
}
|
||||||
return a.storage, a.cfg.WebDAVPath, true
|
root := cleanWebDAVRoot(strings.TrimRight(a.cfg.WebDAVPath, "/") + "/" + user.Username)
|
||||||
|
return a.storage, root, true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user