mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
100 lines
3.2 KiB
PHP
Executable File
100 lines
3.2 KiB
PHP
Executable File
<?php
|
|
|
|
// Copyright (C) 2010-2024 Combodo SAS
|
|
//
|
|
// This file is part of iTop.
|
|
//
|
|
// iTop 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, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// iTop 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 iTop. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
/**
|
|
* Authent External
|
|
* User authentication Module, for authentication outside of the iTop application
|
|
* for example using a .htaccess file. The web server is in charge of authentifying the users
|
|
* and providing the name (= 'login') of the authentified user in the $_SERVER['REMOTE_USER']
|
|
* variable that is passed to PHP. iTop will not make any attempt to authentify such users.
|
|
* Similarly once inside iTop, there is no way for the users to change their password or
|
|
* log off from the iTop application, this has to be handled outside of iTop.
|
|
*
|
|
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
* @license http://opensource.org/licenses/AGPL-3.0
|
|
*/
|
|
|
|
class UserExternal extends User
|
|
{
|
|
public static function Init()
|
|
{
|
|
$aParams =
|
|
[
|
|
"category" => "addon/authentication,grant_by_profile,silo",
|
|
"key_type" => "autoincrement",
|
|
"name_attcode" => "login",
|
|
"state_attcode" => "",
|
|
"reconc_keys" => ['login'],
|
|
"db_table" => "",
|
|
"db_key_field" => "id",
|
|
"db_finalclass_field" => "",
|
|
];
|
|
MetaModel::Init_Params($aParams);
|
|
MetaModel::Init_InheritAttributes();
|
|
|
|
// Display lists
|
|
MetaModel::Init_SetZListItems(
|
|
'details',
|
|
[
|
|
'col:col1' =>
|
|
[
|
|
'fieldset:User:info' => ['contactid', 'org_id', 'email', 'login', 'language', 'status'],
|
|
],
|
|
'col:col2' =>
|
|
[
|
|
'fieldset:User:profiles' => ['profile_list'],
|
|
],
|
|
'allowed_org_list',
|
|
'log',
|
|
]
|
|
); // Attributes to be displayed for the complete details
|
|
MetaModel::Init_SetZListItems('list', ['first_name', 'last_name', 'login', 'status']); // Attributes to be displayed for a list
|
|
// Search criteria
|
|
MetaModel::Init_SetZListItems('standard_search', ['login', 'contactid', 'status', 'org_id']); // Criteria of the std search form
|
|
MetaModel::Init_SetZListItems('advanced_search', ['login', 'contactid', 'status', 'org_id']); // Criteria of the advanced search form
|
|
}
|
|
|
|
/**
|
|
* Check the user's password... always return true. Actually the password
|
|
* is not even passed to this function, we trust the web server for authentifiying
|
|
* the users
|
|
*/
|
|
public function CheckCredentials($sPassword)
|
|
{
|
|
// External authentication: for iTop it's always Ok
|
|
return true;
|
|
}
|
|
|
|
public function TrustWebServerContext()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function CanChangePassword()
|
|
{
|
|
// External authentication: iTop has no way to change a user's password
|
|
return false;
|
|
}
|
|
|
|
public function ChangePassword($sOldPassword, $sNewPassword)
|
|
{
|
|
return false;
|
|
}
|
|
}
|