Assign SUPERUSER to human users by default.

This commit is contained in:
Oleksii Kliukin 2017-03-10 12:50:01 +00:00 committed by Murat Kabilov
parent 34ac47aed9
commit 45fcb2adc9
2 changed files with 3 additions and 1 deletions

View File

@ -50,6 +50,7 @@ func (c *Cluster) createPgUser(user spec.PgUser) (isHuman bool, err error) {
if user.Password == "" {
isHuman = true
flags = append(flags, "SUPERUSER")
flags = append(flags, fmt.Sprintf("IN ROLE \"%s\"", constants.PamRoleName))
} else {
isHuman = false

View File

@ -270,6 +270,7 @@ func (c *Cluster) deleteSecret(secret *v1.Secret) error {
}
func (c *Cluster) createUsers() error {
// TODO: figure out what to do with duplicate names (humans and robots) among pgUsers
for username, user := range c.pgUsers {
if username == constants.SuperuserName || username == constants.ReplicationUsername {
continue
@ -283,7 +284,7 @@ func (c *Cluster) createUsers() error {
userType = "robot"
}
if err != nil {
return fmt.Errorf("Can't create %s user '%s': %s", userType, username, err)
c.logger.Warnf("Can't create %s user '%s': %s", userType, username, err)
}
}