Add Internal User¶
Note
Tenant, Data Model and Role should have been created before this step.
It requires 3 steps to fully create an internal user with password and security questions:
- Create a user with an associated role.
- Prepare an empty UserDetail object.
- Populate user details.
- Populate user role.
- Call POST user API, and receive back the saved id.
- Generate a password link for the user.
- Prepares a UserDetail object as API input.
- Call POST user/generatePasswordLink API, and receive back the hash value.
- Save the password and security questions for user.
- Prepares a UserDetail object as API input.
- Populate the user password.
- Populate the hash value for verification.
- Call POST user/passwordAndSecurityQuestion API.
Empty UserDetail object¶
Empty UserDetail object:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | {
"id": null,
"systemAdmin": false,
"userName": "",
"tenantId": null,
"emailAddress": null,
"roles": [],
"lastName": "",
"firstName": "",
"fullName": null,
"dataOffset": 0,
"timestampOffset": 0,
"cultureName": "",
"dateFormat": ""
}
|
Populate UserDetail object¶
Populate the fields.
userName
,firstName
,lastName
,emailAddress
,dataOffset
,timestampOffset
anddateFormat
with the user detailstenantId
with the actual tenant id
Get the list of tenants from GET tenant/activeTenantsroles
with the selected role id
Get the list of roles from GET role/all/(tenant_id)
Sample populated UserDetail object:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | {
"id": null,
"systemAdmin": false,
"userName": "dwebb",
"tenantId": "d34515f6-cd6f-4e40-bb65-c930ef61f528",
"emailAddress": null,
"roles": [
{
"id": "98bfcd0c-76eb-46e3-acca-500a6bc18caf"
}
],
"lastName": "Webb",
"firstName": "David",
"fullName": null,
"dataOffset": 0,
"timestampOffset": 0,
"cultureName": "en-US",
"dateFormat": "MM/DD/YYYY"
}
|
Call POST user API¶
- Receive back the OperationResult object
- Check that the success field equals true.
- Remember the assigned value in data.id.
Sample response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | {
"success": true,
"messages": null,
"data": {
"password": null,
"roles": [
{
"name": null,
"tenantId": null,
"active": false,
"notAllowSharing": false,
"id": "98bfcd0c-76eb-46e3-acca-500a6bc18caf",
"state": 0,
"deleted": false,
"inserted": true,
"version": null,
"created": null,
"createdBy": "John Doe",
"modified": null,
"modifiedBy": null
}
],
"userRoles": [
{
"userId": "ab4f931f-bd35-420c-b341-b022ea1d1e7c",
"roleId": "98bfcd0c-76eb-46e3-acca-500a6bc18caf",
"id": "386fb900-2d36-46fe-bc8c-dcebbe88fc4d",
"state": 0,
"deleted": false,
"inserted": true,
"version": 1,
"created": "2017-05-10T04:13:54.7143356",
"createdBy": "John Doe",
"modified": "2017-05-10T04:13:54.7143356",
"modifiedBy": "John Doe"
}
],
"userSecurityQuestions": null,
"status": 3,
"issueDate": "0001-01-01T00:00:00",
"autoLogin": false,
"newPassword": null,
"userName": "dwebb",
"emailAddress": null,
"firstName": "David",
"lastName": "Webb",
"tenantId": "d34515f6-cd6f-4e40-bb65-c930ef61f528",
"tenantDisplayId": null,
"tenantName": null,
"dataOffset": 0,
"timestampOffset": 0,
"initPassword": false,
"active": false,
"retryLoginTime": null,
"lastTimeAccessed": null,
"passwordLastChanged": null,
"locked": null,
"lockedDate": null,
"cultureName": "en-US",
"securityQuestionLastChanged": null,
"dateFormat": "MM/DD/YYYY",
"systemAdmin": false,
"notAllowSharing": false,
"numberOfFailedSecurityQuestion": null,
"fullName": "David Webb",
"currentModules": null,
"id": "d4fdd98f-ac63-4836-a011-6567b2641b3a",
"state": 0,
"deleted": false,
"inserted": true,
"version": 1,
"created": "2017-05-10T04:13:54.7119596",
"createdBy": "John Doe",
"modified": "2017-05-10T04:13:54.7119596",
"modifiedBy": "John Doe"
}
}
|
Generate a password link for the user¶
- Prepare the input UserDetail object.
UserDetail object
id
filled with the assigned iduserName
,firstName
,lastName
andemailAddress
must be the same as the values in the saved user
1 2 3 4 5 6 7 | {
"id": "d4fdd98f-ac63-4836-a011-6567b2641b3a",
"userName": "dwebb",
"firstName": "David",
"lastName": "Webb",
"emailAddress": null
}
|
- Call POST user/generatePasswordLink API.
- Receive back the OperationResult object
- Check that the success field equals true.
- Remember the hash value in data.
Sample response
1 2 3 4 5 | {
"success": true,
"messages": null,
"data": "Abc/Def/...=="
}
|
Save the password and security questions for user¶
- Prepare the input UserDetail object.
UserDetail object
verification
filled with the hash value from last steppassword
populated with user-selected passworduserSecurityQuestions
populated with the secret answers for security questionsautoLogin
true to login the user after this step to immediately use the system
1 2 3 4 5 6 7 8 9 10 11 12 | {
"tenantDisplayID": "stark",
"tenantName": "Stark Industries",
"password": "secret",
"verification": "Abc/Def/...==",
"userName": "dwebb",
"firstName": "David",
"lastName": "Webb",
"emailAddress": null,
"userSecurityQuestions": [],
"autoLogin": true
}
|
- Call POST user/passwordAndSecurityQuestion API.
- Check that the success field equals true.
- If autoLogin, use the value in data.token as
access_token
in subsequent REST API calls.
Sample response:
1 2 3 4 5 6 7 8 9 10 11 12 13 | {
"success": true,
"messages": null,
"data": {
"token": "Abc/Def/.../==",
"tenant": "d34515f6-cd6f-4e40-bb65-c930ef61f528",
"cultureName": "en-US",
"dateFormat": "MM/DD/YYYY",
"systemAdmin": false,
"isExpired": false,
"notifyDuringDay": null
}
}
|