Documentation
¶
Index ¶
- Constants
- Variables
- func BuildDownProxyURL(downProxyURL, path string, useSign bool) string
- func CanAccess(user *model.User, meta *model.Meta, reqPath string, password string) bool
- func CanAccessWithRoles(u *model.User, meta *model.Meta, reqPath, password string) bool
- func CanReadPathByRole(u *model.User, reqPath string) bool
- func CanWrite(meta *model.Meta, path string) bool
- func CheckPathLimitWithRoles(u *model.User, reqPath string) bool
- func ErrorResp(c *gin.Context, err error, code int, l ...bool)
- func ErrorStrResp(c *gin.Context, str string, code int, l ...bool)
- func ErrorWithDataResp(c *gin.Context, err error, code int, data interface{}, l ...bool)
- func GenerateToken(user *model.User) (tokenString string, err error)
- func GetApiUrl(r *http.Request) string
- func GetEtag(file model.Obj) string
- func GetHttpReq(ctx context.Context) *http.Request
- func HasChildPermission(u *model.User, reqPath string, bit uint) bool
- func HasPermission(perm int32, bit uint) bool
- func InvalidateToken(tokenString string) error
- func IsApply(metaPath, reqPath string, applySub bool) bool
- func IsStorageSignEnabled(rawPath string) bool
- func IsTokenInvalidated(tokenString string) bool
- func MergeRolePermissions(u *model.User, reqPath string) int32
- func Pluralize(count int, singular, plural string) string
- func Proxy(w http.ResponseWriter, r *http.Request, link *model.Link, file model.Obj) error
- func ProxyRange(link *model.Link, size int64)
- func ShouldProxy(storage driver.Driver, filename string) bool
- func Sign(obj model.Obj, parent string, encrypt bool) string
- func SuccessResp(c *gin.Context, data ...interface{})
- func SuccessWithMsgResp(c *gin.Context, msg string, data ...interface{})
- type InterceptResponseWriter
- type PageResp
- type Resp
- type UserClaims
- type WrittenResponseWriter
Constants ¶
View Source
const ( PermSeeHides = iota PermAccessWithoutPassword PermAddOfflineDownload PermWrite PermRename PermMove PermCopy PermRemove PermWebdavRead PermWebdavManage PermFTPAccess PermFTPManage PermReadArchives PermDecompress PermPathLimit )
Variables ¶
View Source
var NoProxyRange = &model.RangeReadCloser{}
View Source
var SecretKey []byte
Functions ¶
func BuildDownProxyURL ¶ added in v3.56.0
func CanAccessWithRoles ¶ added in v3.46.0
func CanReadPathByRole ¶ added in v3.50.0
func CheckPathLimitWithRoles ¶ added in v3.46.0
CheckPathLimitWithRoles checks whether the path is allowed when the user has the `PermPathLimit` permission for the target path. When the user does not have this permission, the check passes by default.
func ErrorWithDataResp ¶ added in v3.5.1
func HasChildPermission ¶ added in v3.50.0
HasChildPermission checks whether any child path under reqPath grants the specified permission bit.
func HasPermission ¶ added in v3.46.0
func InvalidateToken ¶ added in v3.37.0
func IsStorageSignEnabled ¶ added in v3.15.0
func IsTokenInvalidated ¶ added in v3.37.0
func MergeRolePermissions ¶ added in v3.46.0
func ProxyRange ¶ added in v3.35.0
func ShouldProxy ¶ added in v3.14.0
ShouldProxy TODO need optimize when should be proxy? 1. config.MustProxy() 2. storage.WebProxy 3. proxy_types
func SuccessResp ¶
func SuccessWithMsgResp ¶ added in v3.43.0
Types ¶
type InterceptResponseWriter ¶ added in v3.45.0
type InterceptResponseWriter struct {
http.ResponseWriter
io.Writer
}
type PageResp ¶
type PageResp struct {
Content interface{} `json:"content"`
Total int64 `json:"total"`
}
type UserClaims ¶
type UserClaims struct {
Username string `json:"username"`
PwdTS int64 `json:"pwd_ts"`
jwt.RegisteredClaims
}
func ParseToken ¶
func ParseToken(tokenString string) (*UserClaims, error)
type WrittenResponseWriter ¶ added in v3.45.0
type WrittenResponseWriter struct {
http.ResponseWriter
// contains filtered or unexported fields
}
func (*WrittenResponseWriter) IsWritten ¶ added in v3.45.0
func (ww *WrittenResponseWriter) IsWritten() bool
Click to show internal directories.
Click to hide internal directories.