Other: added user's primary email address to the vault.

This commit is contained in:
Xavier Michelon
2023-01-17 10:16:12 +01:00
parent 03c8c323bc
commit a377384553
8 changed files with 70 additions and 20 deletions

View File

@ -125,9 +125,9 @@ func (vault *Vault) ForUser(parallelism int, fn func(*User) error) error {
})
}
// AddUser creates a new user in the vault with the given ID and username.
// AddUser creates a new user in the vault with the given ID, username and password.
// A bridge password and gluon key are generated using the package's token generator.
func (vault *Vault) AddUser(userID, username, authUID, authRef string, keyPass []byte) (*User, error) {
func (vault *Vault) AddUser(userID, username, primaryEmail, authUID, authRef string, keyPass []byte) (*User, error) {
logrus.WithField("userID", userID).Info("Adding vault user")
var exists bool
@ -138,7 +138,7 @@ func (vault *Vault) AddUser(userID, username, authUID, authRef string, keyPass [
}); idx >= 0 {
exists = true
} else {
data.Users = append(data.Users, newDefaultUser(userID, username, authUID, authRef, keyPass))
data.Users = append(data.Users, newDefaultUser(userID, username, primaryEmail, authUID, authRef, keyPass))
}
}); err != nil {
return nil, err