[WIP] Add 'admin' option to create role (#425)

* Add 'admin' option to create role

* Fix run_locally_script
This commit is contained in:
zerg-junior
2018-12-27 10:14:33 +01:00
committed by GitHub
parent 26670408c4
commit c0b0b9a832
7 changed files with 22 additions and 6 deletions
+9 -4
View File
@@ -709,11 +709,16 @@ func (c *Cluster) initRobotUsers() error {
if err != nil {
return fmt.Errorf("invalid flags for user %q: %v", username, err)
}
adminRole := ""
if c.OpConfig.EnableAdminRoleForUsers {
adminRole = c.OpConfig.TeamAdminRole
}
newRole := spec.PgUser{
Origin: spec.RoleOriginManifest,
Name: username,
Password: util.RandomPassword(constants.PasswordLength),
Flags: flags,
Origin: spec.RoleOriginManifest,
Name: username,
Password: util.RandomPassword(constants.PasswordLength),
Flags: flags,
AdminRole: adminRole,
}
if currentRole, present := c.pgUsers[username]; present {
c.pgUsers[username] = c.resolveNameConflict(&currentRole, &newRole)