Create an user and setup is access rights
Description
In this tutorial you will learn how to create a new user and define its access on OnSphere.
We will:
add a new
example
userconfigure new user with an initial
mysuperpassword
passwordconfigure new user so that it has to change its default password on the first login
add a new
collaborator
groupconfigure new
example
user to be part of newcollaborator
groupconfigure new
collaborator
group to authorize it to access thecollaborator
dashboard
Steps
1. Initial setup
git pull
git merge origin/osp-web-configuration
2. Create the group
With the configuration
Open the
/modules/keycloak/keycloak-1/groups.keycloak
fileCreate the new group:
{ "groups": [ { "attributes": {}, "clientRoles": {}, "name": "collaborator", "path": "/collaborator", "realmRoles": [], "subGroups": [] } ] }
With the front-end
Connect to Keycloak
With the administrator
Access the Keycloak administration console
https://{stack_ip}:{stack_port}/auth/admin
(for example https://stack-1.onsphere.local:5000/auth/admin)Login to Keycloak administration console using administration user and password configured when the stack was deployed (see System security)
With a user member of the
administrator
oruser-management
group
Access the OnSphere front-end
https://{stack_ip}:{stack_port}/
(for example https://stack-1.onsphere.local:5000/)On the side menu click on the
Manage users
button !![]()
Go to the
Groups
tab underManage
categoryClick on
New
Enter the group name
collaborator
and clickSave
3. Map the group to OnSphere
Open the
/modules/rights/rights/rights.module
fileCreate the new mapping for the
collaborators
andadmin
:
{ "messagingConfiguration": { "clientId": "osp-rights", "host": "rabbit" }, "groups": [ { "name": "all", "description": "Access all value", "externalLink": [ "data-access", "configuration-management" ] }, { "name": "collaborator", "description": "", "externalLink": [ "collaborator" ] }, { "name": "admin", "description": "", "externalLink": [ "administrator" ] } ] }Warning
By default the
externalLink
used the name of the group as it’s identifier.It is possible to change this behavior to use the full path by editing the
realm.keycloak
available on theosp-keycloak-advanced-configuration
branch.The
protocolMappers
namedUser groups
need to be edited to changeconfig.full.path
to true. There are two of them by default.
4. Create the user
With the configuration
Open the
/modules/keycloak/keycloak-1/users.keycloak
fileCreate the new user:
{ "users": [ { "enabled": true, "groups": [ "/collaborator" ], "username": "example", "email": "example@localhost", "firstName": "example", "lastName": "example", "credentials": [ { "initial": true, "temporary": true, "type": "password", "value": "mysuperpassword" } ], "attributes": { "authorizedKeys": [], "apiKey": "simple-api-key" } } ] }
With the front-end
Connect to Keycloak
With the administrator
Access the Keycloak administration console
https://{stack_ip}:{stack_port}/auth/admin
(for example https://stack-1.onsphere.local:5000/auth/admin)Login to Keycloak administration console using administration user and password configured when the stack was deployed (see System security)
With a user member of the
administrator
oruser-management
group
Access the OnSphere front-end
https://{stack_ip}:{stack_port}/
(for example https://stack-1.onsphere.local:5000/)On the side menu click on the
Manage users
button !![]()
Go to the
Users
tab underManage
categoryClick on
Add user
Enter a username and click
Save
Go to the
Credentials
tabDefine a password for the user and click
Set Password
Go to the
Groups
tabIn the
Available groups
panel, select the groupcollaborator
and clickJoin
5. Create the dashboard and the access file
_root/examples/dashboard/admin/dashboard.view_
{
"configuration": [
],
"layout": {
"lg": []
}
}
_root/examples/dashboard/admin/dashboard.web_
{
"moduleId": "modules.web.web-1",
"title": "Admin dashboard",
"description": "Admin dashboard",
"tags": ["Admin"]
}
_root/examples/dashboard/admin/access.rights_
{
"moduleId": "modules.rights.rights",
"write": {
"override": [
"admin"
]
},
"read": {
"override": [
"admin"
]
}
}
_root/examples/dashboard/collaborator/dashboard.view_
{
"configuration": [
],
"layout": {
"lg": []
}
}
_root/examples/dashboard/collaborator/dashboard.web_
{
"moduleId": "modules.web.web-1",
"title": "collaborator dashboard",
"description": "collaborator dashboard",
"tags": ["collaborator"]
}
_root/examples/dashboard/collaborator/access.rights_
{
"moduleId": "modules.rights.rights",
"write": {
"override": [
"collaborator"
]
},
"read": {
"override": [
"collaborator"
]
}
}
6. Push the new configuration
git add .
git commit -m "Creating new user with access"
git pull
git push
7. Connect on OnSphere with the new user


