feat: sort obj list

This commit is contained in:
Noah Hsu
2022-06-27 19:10:02 +08:00
parent f01a81ee9c
commit c6007aa9e6
4 changed files with 122 additions and 13 deletions

View File

@ -1,6 +1,7 @@
package fs
import (
"github.com/alist-org/alist/v3/pkg/utils"
"io"
"mime"
"net/http"
@ -63,3 +64,19 @@ 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
}