updates
parent
716d6d7e7a
commit
761f6a6e30
|
@ -28,6 +28,8 @@ type FileManager struct {
|
||||||
// a trailing slash.
|
// a trailing slash.
|
||||||
WebDavURL string
|
WebDavURL string
|
||||||
|
|
||||||
|
scopes map[string]*scope
|
||||||
|
|
||||||
// Users is a map with the different configurations for each user.
|
// Users is a map with the different configurations for each user.
|
||||||
Users map[string]*User
|
Users map[string]*User
|
||||||
|
|
||||||
|
@ -36,10 +38,16 @@ type FileManager struct {
|
||||||
AfterSave CommandFunc
|
AfterSave CommandFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type scope struct {
|
||||||
|
path string
|
||||||
|
fileSystem webdav.FileSystem
|
||||||
|
handler *webdav.Handler
|
||||||
|
}
|
||||||
|
|
||||||
// User contains the configuration for each user.
|
// User contains the configuration for each user.
|
||||||
type User struct {
|
type User struct {
|
||||||
// scope is the physical path the user has access to.
|
// scope is the physical path the user has access to.
|
||||||
scope string
|
scope *scope
|
||||||
|
|
||||||
// fileSystem is the virtual file system the user has access.
|
// fileSystem is the virtual file system the user has access.
|
||||||
fileSystem webdav.FileSystem
|
fileSystem webdav.FileSystem
|
||||||
|
@ -153,9 +161,10 @@ func (m *FileManager) SetWebDavURL(url string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *User) SetScope(scope string) {
|
// SetScope updates a user scope and its virtual file system.
|
||||||
u.scope = strings.TrimSuffix(scope, "/")
|
func (m *FileManager) SetScope(scope string, user string) {
|
||||||
u.fileSystem = webdav.Dir(u.scope)
|
m.scope = strings.TrimSuffix(scope, "/")
|
||||||
|
m.fileSystem = webdav.Dir(m.scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allowed checks if the user has permission to access a directory/file.
|
// Allowed checks if the user has permission to access a directory/file.
|
||||||
|
|
Loading…
Reference in New Issue