Start a new topic

How to upload about 100+ user definition from Excel ?

I would like to upload Semarchy User definition from Excel to Semarchy to support Semarchy deployment onto new sites.
It should be an excel file with user and role definition.

Export/Import is not available from the User definition screnn in Semarchy. Any advise please ?


Hello Jean-François


In deed, there is no export or import option in order to work with excel/csv files.


Nonetheless, there are API endpoints on roles and users to externally managed roles and users, which is very convenient when working with many environments.

Notably:

- /admin/roles endpoint with a GET action to retrieve all roles

- same endpoint with PUT to replace all roles by those provided in the request body

- /admins/users with GET action to retrieve all users with their preferences and roles

- same endpoint with PUT action to replace all users with those provided in the request body


The swagger contains additional details (syntax, samples, ...) in its "Platform Administration" section.


I hope this will fulfil your needs.

Guillaume

I gave it a try, GET user works, however with PUT I have difficulties:

- it needs an API key to work (done SemarchyAdmin + SemarchyConnect)

- with admin rights (done)

- but still failes with the bellow message :


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">

    <title>Status 403</title>


    <link rel="stylesheet prefetch" href="/semarchy/login/res/material.min.css">

    <link rel="stylesheet" href="/semarchy/login/res/style.css">


    <link rel='icon' href='/semarchy/img/favicon.ico' type='image/x-icon' />

</head>

<body>

    <div class="mdl-layout mdl-js-layout mdl-color--grey-100">

        <main class="mdl-layout__content">

            <div class="mdl-card sem-card--login mdl-shadow--6dp">

                <div class="mdl-card__title mdl-color--grey-200" style="background:url('/semarchy/login/res/login-product-logo.png') center / cover;">

                </div>

                <div class="mdl-card__supporting-text">

                    <h3 class="mdl-typography--title">

                        403 Forbidden

                    </h3>

                    <div>

 

                        You do not have the permissions to access the application. Please contact your administrator.

 

                    </div>

 

 

                    <a href="/semarchy/logout"><button class="mdl-button mdl-button--colored mdl-button--raised mdl-js-button mdl-js-ripple-effect sem-button--fullwidth">Click here to login now</button></a>

 

                </div>

            </div>

        </main>

    </div>

    <script src="/semarchy/login/res/material.min.js"></script>

</body>

</html>

Hello Jean-François,


For consistency purposes, a user cannot delete itself, and the PUT action on the admin/users endpoint rewrite all users, therefore it can only be done with an API key.


Please double-check the roles associated to the API key are sufficient (notably Read/Write on user management).

If you still face issues, feel free to contact the support.


Guillaume

API key has SemarchyConnect and SemarchyAdmin roles. I will create a Support ticket.


But this procedure leads to a los of all user passwords. Noone can login anymore. including semadmin.


Hello,


For security purposes, the passwords are not retrieved with the GET method and cannot be set with the PUT method.

This is an issue only for users using the internal IDP, users on LDAP, SAML, and other SSO do not have this lack of password (as long as the related IDP is configured, which can be done via the API).


To set the password of the created user that are using the internal IDP, you can call the /admin/users/{name}/enableInternalIDP or the /admin/users/{name}/resetPassword endpoint with the POST method.

For example, using an API key for the authentication you can call http://localhost:8088/semarchy/api/rest/admin/users/semadmin/enableInternalIDP with POST method and the following request body:


{
"password": "Qwerty123!",
"requestPasswordChange": false,
"sendNotificationEmail": false
}


This way, the user will be able to connect with the specified password. The user can also be emailed with the password, and prompted to change it at the next connection.

I hope this makes things clearer.


Guillaume

I get an error 500 "unexpected error"

Screen shot below


image


Hello,


The example password is not strong enough, you will need a longer, stronger password.

You can also try the restetPassword endpoint.

If you have another access to the platform, you can check the logs for this errorId.

I see the support ticket is ongoing, feel free to provide more details if the issue persists.


Guillaume

Login to post a comment