Source
$userdirectory_mediaids = array_column($userdirectory['provision_media'], 'userdirectory_mediaid', 'mediatypeid');
<?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/>.
**/
require_once dirname(__FILE__) . '/common/CAPIScimTest.php';
/**
* @onBefore prepareUserData
*
* @onAfter clearData
*/
class testScimUser extends CAPIScimTest {
private static $data = [
'userdirectoryid' => [
'ldap' => null,
'saml' => null
],
'userid' => [
'ldap_user' => null,
'saml_user_active' => null,
'saml_user_inactive' => null,
'saml_user_only_username' => null,
'saml_user_with_media' => null,
'admin' => null,
'user' => null,
'guest_user' => null
],
'username' => [
'ldap_user' => 'dwight.schrute@office.com',
'saml_user_active' => 'jim.halpert@office.com',
'saml_user_inactive' => 'pam.beesly@office.com',
'saml_user_only_username' => 'andy.bernard@office.com',
'saml_user_with_media' => 'bob.schrute@office.com'
],
'tokenids' => [
'superadmin' => null,
'admin' => null,
'user' => null,
'guest_user' => null
],
'tokens' => [
'admin' => null,
'user' => null,
'guest_user' => null,
'no_token' => null
],
'mediatypeid' => [
'SMS' => '3',
'Email' => '1'
],
'scim_groupids' => [
'group_w_members' => null
],
'user_scim_groupids' => [
'user_group_w_members' => null
]
];
public function prepareUserData(): void {
// Create userdirectory for SAML.
$userdirectory_saml = CDataHelper::call('userdirectory.create', [
'idp_type' => IDP_TYPE_SAML,
'group_name' => 'groups',
'idp_entityid' => 'http://www.okta.com/abcdef',
'sso_url' => 'https://www.okta.com/ghijkl',
'username_attribute' => 'usrEmail',
'user_username' => 'user_name',
'user_lastname' => 'user_lastname',
'provision_status' => JIT_PROVISIONING_ENABLED,
'sp_entityid' => '',
'provision_media' => [
[
'name' => 'SMS',
'mediatypeid' => self::$data['mediatypeid']['SMS'],
'attribute' => 'user_mobile'
],
[
'name' => 'Email',