Skip to content

Commit

Permalink
Fix permissions not being checked correctly for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
DaneEveritt committed May 30, 2022
1 parent f390784 commit 7fa7cc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.6.3
### Fixed
* Fixes SFTP authentication failing for administrative users due to a permissions adjustment on the Panel.

## v1.6.2
### Fixed
* Fixes file upload size not being properly enforced.
Expand Down
10 changes: 3 additions & 7 deletions sftp/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,10 @@ func (h *Handler) can(permission string) bool {
return false
}

// SFTPServer owners and super admins have their permissions returned as '[*]' via the Panel
// API, so for the sake of speed do an initial check for that before iterating over the
// entire array of permissions.
if len(h.permissions) == 1 && h.permissions[0] == "*" {
return true
}
for _, p := range h.permissions {
if p == permission {
// If we match the permission specifically, or the user has been granted the "*"
// permission because they're an admin, let them through.
if p == permission || p == "*" {
return true
}
}
Expand Down

0 comments on commit 7fa7cc3

Please sign in to comment.