(reqPath string)
| 155 | } |
| 156 | |
| 157 | func (u *User) JoinPath(reqPath string) (string, error) { |
| 158 | if reqPath == "/" { |
| 159 | return utils.FixAndCleanPath(u.BasePath), nil |
| 160 | } |
| 161 | path, err := utils.JoinBasePath(u.BasePath, reqPath) |
| 162 | if err != nil { |
| 163 | return "", err |
| 164 | } |
| 165 | |
| 166 | if path != "/" && u.CheckPathLimit() { |
| 167 | basePaths := GetAllBasePathsFromRoles(u) |
| 168 | match := false |
| 169 | for _, base := range basePaths { |
| 170 | if utils.IsSubPath(base, path) { |
| 171 | match = true |
| 172 | break |
| 173 | } |
| 174 | } |
| 175 | if !match { |
| 176 | return "", errs.PermissionDenied |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | return path, nil |
| 181 | } |
| 182 | |
| 183 | func StaticHash(password string) string { |
| 184 | return utils.HashData(utils.SHA256, []byte(fmt.Sprintf("%s-%s", password, StaticHashSalt))) |
no test coverage detected