You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
fix: correctly check if command is allowed when using shell
This commit is contained in:
@@ -2,7 +2,6 @@ package users
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"slices"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
|
||||
@@ -104,12 +103,3 @@ func (u *User) Clean(baseScope string, fields ...string) error {
|
||||
func (u *User) FullPath(path string) string {
|
||||
return afero.FullBaseFsPath(u.Fs.(*afero.BasePathFs), path)
|
||||
}
|
||||
|
||||
// CanExecute checks if an user can execute a specific command.
|
||||
func (u *User) CanExecute(command string) bool {
|
||||
if !u.Perm.Execute {
|
||||
return false
|
||||
}
|
||||
|
||||
return slices.Contains(u.Commands, command)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user