Adding Users during Plattform Server Startup

The mgm.services.core.user.document-resources.users [property]<INTERNAL_LINK> requires documents of the DomainUser model to point to. I tried to use an adapted DomainUser model obtained via the the server API. However, parsing my file fails during server startup:

[…]
com.mgmtp.a12.model.data.document.serialization.DocumentSerializationException: Error parsing document from XML.
[…]
Caused by: org.jdom2.input.JDOMParseException: Error on line 1: Content is not allowed in prolog.

This is the file I used:
admin.xml (785 Bytes)

Maybe someone has an idea what’s the issue or even could provide a template for the DomainUser document files?

This looks like an encoding problem with your xml file.

There are a couple of problems with your admin user:

  1. The error looks like there is a encoding issue please make sure that you are using UTF-8
  2. The property mgm.services.core.user.document-resources.users is used to import all users to the database, therefore only user present will be myAdmin, if your database does not have any user. This means that you need to setup a password for that user otherwise you will not be able to log in. You can use default admin to create users that you can later on import. Or you can generate password (with proper salt) based on the algorithm in PasswordSecurityService#calculatePasswordHash, Or you can use password hash and salt from adminUser document and past it to yours and change password later.
  3. The id is missing on the root of your document. For the new documents you can use -1

Here is an example of user document which can be used right away:

<?xml version="1.0" encoding="UTF-8"?>
<DomainUser id="-1">
    <SystemProperties>
        <login>myadmin</login>
        <firstname>myad</firstname>
        <lastname>min</lastname>
        <email>test.myadmin@<INTERNAL_LINK>>
        <password>9d94e2de7c38910b6b6279b02be2af824f30d8132d322e59e458b91fc5b551d66a3605a8d42ee62d7a60f03b8253195e303a7de3a34463394f3e0d1a3876557a</password>
        <passwordRepeat></passwordRepeat>
        <roles>
            <roleIdent>systemAdmin</roleIdent>
        </roles>
        <roles>
            <roleIdent>admin</roleIdent>
        </roles>
        <salt>cf41c880e9b55316c3b8ccb0e8aad01f</salt>
        <lastLoginAt></lastLoginAt>
        <failedLoginAt/>
        <failedLoginAttempts>0</failedLoginAttempts>
        <passwordChangedAt>2018-09-18T00:00:00.000+00:00</passwordChangedAt>
        <restorePasswordToken/>
        <passwordTokenCreatedAt/>
        <createdAt></createdAt>
        <active>true</active>
        <existing>false</existing>
        <documentId/>
        <enforcePasswordChange>false</enforcePasswordChange>
    </SystemProperties>
</DomainUser>

This user has password admin. If you want to setup additional user characteristics please take a look here:
<INTERNAL_LINK>