apache / pulsar-manager

Apache Pulsar Manager
https://pulsar.apache.org/
Apache License 2.0
516 stars 245 forks source link

fix: check for existing superuser #564

Closed maranmaran closed 5 months ago

maranmaran commented 5 months ago

Fixes #563 and #537

Motivation

When creating superuser, currently there's no guard to protect against already created superuser. If you seed superuser more then one times, it breaks login for that particular user as the request throws InternalServerError on login

Modifications

In the same style of other guards within UsersController I've added query to repository to get entity by name for the incoming user payload. If the entity exists we return validation error.

Verifying this change

lhotari commented 5 months ago

Thanks for the contribution @maranmaran