Working with user permissions
- Last Updated: November 20, 2023
- 2 minute read
- Hybrid Data Pipeline
- Version 5.0
- Documentation
Administrators can use the Users API to create users with a specific role and set permissions explicitly on users. The permissions for a user are the sum of the permissions granted to the user's role(s) and permissions granted explicitly to the user. When creating a user, the administrator must assign the user a role.
Create a new user
The following POST creates a user with the ODataOnly role. The user inherits the permissions associated with this role. The administrator must have the Administrator (12) permission, or the CreateUsers (13) permission and administrative access on the tenant.
Request
POST https://MyServer:8443/api/admin/users
Request Payload
{
"userName": "ODataUser",
"tenantId": 56,
"statusInfo": {
"status": 1,
"accountLocked": false
},
"passwordInfo": {
"passwordStatus": 1,
"passwordExpiration": null
},
"permissions": {
"roles": [
6
]
}
}
Response Payload
{
"id": 307,
"userName": "ODataUser",
"tenantId": 56,
"statusInfo": {
"status": 1,
"accountLocked": false
},
"passwordInfo": {
"passwordStatus": 1,
"passwordExpiration": null
},
"permissions": {
"roles": [
6
]
},
"authenticationInfo": {
"authUsers": [
{
"authUserName": "ODataUser",
"authServiceId": 1
}
]
}
}
Set explicit permissions on the user
An administrator can then set permissions explicitly on the new user with the
following PUT request, where {id} is the
auto-generated user ID. In this example, the user is explicitly being granted
ChangePassword (9) permission. The administrator must have the Administrator (12)
permission, or the ModifyUsers (15) permission and administrative access on the
tenant.
Request
PUT https://MyServer:8443/api/admin/users/{id}/permissions
Request Payload
{
"roles": [6],
"permissions": [9]
}
Response Payload
{
"roles": [
6
],
"permissions": [
9
]
}
Retrieve permissions on the new user
With the following GET request, the permissions in terms of roles and
explicit permissions can be retrieved for the new user, where {id} is the auto-generated ID of the user. The
administrator must have the Administrator (12) permission, or the ViewUsers (14)
permission and administrative access on the tenant.
Request
GET https://MyServer:8443/api/admin/users/{id}/permissions
Response Payload
{
"roles": [
6
],
"permissions": [
10
]
}