[MRM-1937] Prevent creation of wrong initial admin
Throws a error, if the admin user has the wrong name.
This commit is contained in:
parent
db185cb79d
commit
a3ee32699b
|
@ -103,6 +103,7 @@ cannot.register.user=Unable to process new user registration request.
|
|||
invalid.admin.credentials=Invalid admin credentials, try again.
|
||||
admin.user.already.exists=Admin User exists in database (someone else probably created the user before you).
|
||||
cannot.assign.admin.role=Unable to assign system administrator role.
|
||||
admin.wrongUsername=The username for the primary administrator must be 'admin'.
|
||||
|
||||
# --------------------------------------------------
|
||||
# AssignmentsAction
|
||||
|
|
|
@ -94,6 +94,7 @@ invalid.admin.credentials=Ung\u00FCltige Administrations-Legitimationsdaten. Bit
|
|||
admin.user.already.exists=Der Administrator existiert bereits. Evtl. wurde der Administrator bereits von jemand anderem angelegt, bevor Sie die M\u00F6glichkeit dazu hatten.
|
||||
cannot.assign.admin.role=System-Administrator Rolle kann nicht zugewiesen werden.
|
||||
|
||||
admin.wrongUsername=Der Name für den prim\u00E4ren Administrator mu\u00DF 'admin' lauten.
|
||||
# --------------------------------------------------
|
||||
# AssignmentsAction
|
||||
# --------------------------------------------------
|
||||
|
|
|
@ -504,6 +504,11 @@ public class DefaultUserService
|
|||
{
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
log.debug("Creating admin admin user '{}'", adminUser.getUsername());
|
||||
if (!RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME.equals(adminUser.getUsername())) {
|
||||
log.error("Wrong admin user name {}", adminUser.getUsername());
|
||||
throw new RedbackServiceException(new ErrorMessage("admin.wrongUsername"));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue