fix: correctly check if command is allowed when using shell

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

No files matched your search

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