Получение системного статуса пользователя по идентификатору
Получает статус пользователя в системе.
Метод
- Раздел API: /API2/access
- Версия API: 2.0
- Начиная с релиза: 2018.5
- Использование: только REST API через POST-запросы.
- Кто использует:
- Enterprise Admin
Сигнатура метода
Входные параметры
Имя
userId
Тип
string
Описание
Системный идентификатор пользователя
Выходной ответ
Код успешного результата
200
Тип ответа
string
Описание типа ответа
Флаг «Включён/Отключён»
Примечания
Используется с методом toggleEnableUser.
Примеры
Создание нового пользователя SAML (JavaScript):
В этом примере показано, как создать нового клиента, пользователя и роли в Дельта BI при использовании аутентификации на основе SAML.
В примере используется аутентификация API средствами JavaScript. См. API аутентификации для альтернативных вариантов.
// URL of the Pyramid installation and the path to the API 2.0 REST methods
var pyramidURL = "http://mysite.com/api2/";
// step 1: authenticate admin account and get token
// NOTE: callApi method is a generic REST method shown below.
let token = callApi(“auth/authenticateUser”,{
“data”:{
“userName”:“adminUser”,
“password”:“abc123!”
}
},false);
log(“got token “+token);
// step 2: creating a SAML user
let userId=“83e631f5-98ca-4424-a696-33e109690ffb”
let createSamlUsers = callApi(“access/createUserSaml”,{
“newSamlUser”: {
“id”:userId,//you can set the user id to a specific valid GUID/UUID. Otherwise a GUID will be auto generated
“userName”: “jhon.doe”,
“principalName”:“user@samlDomain.com”,//this is the SAML user ID provided by the saml provider
“firstName”: “john”,
“lastName”:“doe”,
“adminType”:0,//AdminType.None
“clientLicenseType”:100,//ClientLicenseType.Viewer
“email”:“user@mySite.com”,
},
“auth”: token // admin token generated above
});
// step 3: optional step to update user’s first name
let updateUser=callApi(“access/updateUsersSaml”,{
“updateUser”:[{
“id”:userId,
“firstName”:“Paul”
}],
“auth”: token // admin token generated above
});
//step 4: find user by SAML principle name
let getByPrincipalName=callApi(“access/getUserBySamlPrincipalName”,{
“PrincipalName”:“user@samlDomain.com”, //this is the SAML user ID provided by the saml provider
“auth”: token
});
//step 5: get user status by id
let userStatus=callApi(“access/getUserStatusById”,{
“userId”: userId,
“auth”: token
});
log(“user status “+userStatus);
// ##### optional generic logging method for debugging ##############
function log(msg){
document.write(msg);
console.log(msg);
}
// ##### generic REST API calling method ##############
function callApi(path,data,parseResult=true){
var xhttp = new XMLHttpRequest();
xhttp.open(“POST”, pyramidURL+path, false);
xhttp.send(JSON.stringify(data));
if(parseResult){
return JSON.parse(xhttp.responseText);
}else{
return xhttp.responseText;
}
}
</code></pre></details>