Skip to content

Commit

Permalink
let isSystemUsername check all system users
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Nov 29, 2023
1 parent 409e4c7 commit af3cda3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func TestInitRobotUsers(t *testing.T) {
err: nil,
},
}
cl.initSystemUsers()
for _, tt := range tests {
cl.Spec.Users = tt.manifestUsers
cl.pgUsers = tt.infraRoles
Expand Down
9 changes: 8 additions & 1 deletion pkg/cluster/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,14 @@ func (c *Cluster) isProtectedUsername(username string) bool {
}

func (c *Cluster) isSystemUsername(username string) bool {
return (username == c.OpConfig.SuperUsername || username == c.OpConfig.ReplicationUsername)
// is there a pooler system user defined
for _, systemUser := range c.systemUsers {
if username == systemUser.Name {
return true
}
}

return false
}

func isValidFlag(flag string) bool {
Expand Down

0 comments on commit af3cda3

Please sign in to comment.