feat: add user status and path permissions

This commit is contained in:
OpenClaw Agent
2026-09-22 01:30:30 +08:00
parent eafc6c6499
commit 71757ec0fa
5 changed files with 163 additions and 16 deletions
+2 -1
View File
@@ -50,6 +50,7 @@ type Account struct {
Rules []PathRule
Home string
Admin bool
Enabled bool
}
type Manager struct {
Accounts map[string]*Account
@@ -85,7 +86,7 @@ func ParseRules(values []string) (*Manager, error) {
}
func (m *Manager) Authenticate(user, pwd string) *Account {
if a, ok := m.Accounts[user]; ok && (a.Password == pwd || a.PasswordHash == PasswordHash(pwd)) {
if a, ok := m.Accounts[user]; ok && (a.Enabled || a.PasswordHash == "") && (a.Password == pwd || a.PasswordHash == PasswordHash(pwd)) {
return a
}
if user == "" && pwd == "" {