kagemomiji / airsonic-advanced

airsonic-advanced
GNU General Public License v3.0
152 stars 14 forks source link

[Feature Request]: Allow to set up Admin user name #253

Closed zc-devs closed 1 year ago

zc-devs commented 1 year ago

Scope

Other

What problem

Currently there is "no way" to change default admin username.

If I create new full permissions user (say, root_admin) and try to delete old default one, then I get:

There was an unexpected error (type=Internal Server Error, status=500).
org.springframework.dao.InvalidDataAccessApiUsageException: Can't delete admin user.; nested exception is java.lang.IllegalArgumentException: Can't delete admin user.
...
    at org.airsonic.player.controller.UserSettingsController.deleteUser(UserSettingsController.java:179)
    at org.airsonic.player.controller.UserSettingsController.doSubmitAction(UserSettingsController.java:151)
...

If I change name in database manually, then I loose safety check mentioned above.

Feature

I propose to make administrator name configurable.

  1. Allow to set environment variable (Spring property) with custom admin username (and probably password) like Postgres do with POSTGRES_USER (and POSTGRES_PASSWORD), for example.
  2. Only make configurable USERNAME_ADMIN in UserDao. Then we can change username manually in database and don't lose sefety check at least.
The-Exterminator commented 1 year ago

Make a user with admin priv, and delete the admin

The-Exterminator commented 1 year ago

@zc-devs it work before 100%, so you dont need to chance the files :-)