Source
'op' => ['type' => API_STRING_UTF8, 'flags' => API_REQUIRED, 'in' => implode(',', ['add', 'remove', 'replace', 'Add', 'Remove', 'Replace'])],
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
namespace SCIM\services;
use API as APIRPC;
use APIException;
use CApiInputValidator;
use CAuthenticationHelper;
use CProvisioning;
use DB;
use Exception;
use SCIM\ScimApiService;
class User extends ScimApiService {
public const SCIM_SCHEMA = 'urn:ietf:params:scim:schemas:core:2.0:User';
/**
* Returns information on specific user or all users if no specific information is requested.
* If user is not in database, returns only 'schemas' parameter.
*
* @param array $options Array with data from request.
* @param string $options['userName'] UserName parameter from GET request.
* @param string $options['id'] User id parameter from GET request URL.
*
* @return array Array with data necessary to create response.
*
* @throws Exception
*/
public function get(array $options = []): array {
$this->validateGet($options);
$userdirectoryid = CAuthenticationHelper::getSamlUserdirectoryidForScim();
if (array_key_exists('userName', $options)) {
$users = APIRPC::User()->get([
'output' => ['userid', 'username', 'userdirectoryid'],
'selectUsrgrps' => ['usrgrpid'],
'filter' => ['username' => $options['userName']]
]);
if ($users && $users[0]['userdirectoryid'] != $userdirectoryid) {
self::exception(ZBX_API_ERROR_PARAMETERS,
'User with username '.$options["userName"].' already exists.'
);
}
$user_groups = $users ? array_column($users[0]['usrgrps'], 'usrgrpid') : [];
$disabled_groupid = CAuthenticationHelper::get(CAuthenticationHelper::DISABLED_USER_GROUPID);