1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-07 17:47:14 +00:00

userdb: Add a method to remove users

This patch adds a method to userdb to remove users.
It will not be used by chasquid, but by the command-line tool.
This commit is contained in:
Alberto Bertogli
2016-09-23 23:57:20 +01:00
parent 667358d72e
commit 859d4733f8
2 changed files with 37 additions and 1 deletions

View File

@@ -191,6 +191,17 @@ func (db *DB) AddUser(name, plainPassword string) error {
return nil
}
// RemoveUser from the database. Returns True if the user was there, False
// otherwise.
func (db *DB) RemoveUser(name string) bool {
db.mu.Lock()
_, present := db.db.Users[name]
delete(db.db.Users, name)
db.mu.Unlock()
return present
}
///////////////////////////////////////////////////////////
// Encryption schemes
//