mirror of
https://github.com/filebrowser/filebrowser.git
synced 2026-01-23 02:35:10 +00:00
fix: correctly check if command is allowed when using shell
This commit is contained in:
parent
f84a6db680
commit
4d830f707f
4 changed files with 25 additions and 34 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue