fix: correctly check if command is allowed when using shell

This commit is contained in:
Henrique Dias
2025-06-26 21:09:16 +02:00
parent f84a6db680
commit 4d830f707f
4 changed files with 25 additions and 34 deletions

View File

@@ -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)
}