feat: obj list api

This commit is contained in:
Noah Hsu
2022-06-27 19:51:23 +08:00
parent c6007aa9e6
commit 7c0b86a9cd
10 changed files with 157 additions and 24 deletions

View File

@ -1,7 +1,6 @@
package fs
import (
"github.com/alist-org/alist/v3/pkg/utils"
"io"
"mime"
"net/http"
@ -64,19 +63,3 @@ func getFileStreamFromLink(file model.Obj, link *model.Link) (model.FileStreamer
}
return stream, nil
}
func canAccess(user *model.User, meta *model.Meta, path string) bool {
// if is not guest, can access
if user.IsAdmin() || user.IgnorePassword {
return true
}
// if meta is nil or password is empty, can access
if meta == nil || meta.Password == "" {
return true
}
// if meta doesn't apply to sub_folder, can access
if !utils.PathEqual(meta.Path, path) && !meta.SubFolder {
return true
}
return false
}