N°8796 - Add PHP code style validation in iTop and extensions - format whole code base

This commit is contained in:
odain
2025-11-07 15:39:53 +01:00
parent 12f23113f5
commit 890a2568c8
2110 changed files with 53099 additions and 63885 deletions

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
Dict::Add('CS CZ', 'Czech', 'Čeština', [
'CAS:Error:UserNotAllowed' => 'Uživatel není oprávněn',
'CAS:Login:SignIn' => 'Přihlásit se prostřednictvím CAS',
'CAS:Login:SignInTooltip' => 'Klikni zde pro příhlášení prostřednictvím CAS serveru',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('DA DA', 'Danish', 'Dansk', array(
Dict::Add('DA DA', 'Danish', 'Dansk', [
'CAS:Error:UserNotAllowed' => 'User not allowed~~',
'CAS:Login:SignIn' => 'Sign in with CAS~~',
'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('DE DE', 'German', 'Deutsch', array(
Dict::Add('DE DE', 'German', 'Deutsch', [
'CAS:Error:UserNotAllowed' => 'Benutzer ist nicht zugelassen',
'CAS:Login:SignIn' => 'Anmeldung mit CAS',
'CAS:Login:SignInTooltip' => 'Hier klicken, um sich am CAS-Server zu authentifizieren',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -6,8 +7,8 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('EN US', 'English', 'English', array(
Dict::Add('EN US', 'English', 'English', [
'CAS:Error:UserNotAllowed' => 'User not allowed',
'CAS:Login:SignIn' => 'Sign in with CAS',
'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -6,8 +7,8 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('EN GB', 'British English', 'British English', array(
Dict::Add('EN GB', 'British English', 'British English', [
'CAS:Error:UserNotAllowed' => 'User not allowed',
'CAS:Login:SignIn' => 'Sign in with CAS',
'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Spanish Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
* @author Miguel Turrubiates <miguel_tf@yahoo.com>
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
*/
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [
'CAS:Error:UserNotAllowed' => 'Usuario no permitido',
'CAS:Login:SignIn' => 'Iniciar sesión con CAS',
'CAS:Login:SignInTooltip' => 'Click para autenticarse con servidor CAS',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('FR FR', 'French', 'Français', array(
Dict::Add('FR FR', 'French', 'Français', [
'CAS:Error:UserNotAllowed' => 'Utilisateur non autorisé',
'CAS:Login:SignIn' => 'S\'identifier avec CAS',
'CAS:Login:SignInTooltip' => 'Cliquer ici pour s\'identifier avec le serveur CAS',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
Dict::Add('HU HU', 'Hungarian', 'Magyar', [
'CAS:Error:UserNotAllowed' => 'Nem engedélyezett felhasználó',
'CAS:Login:SignIn' => 'Bejelentkezés CAS szerverrel',
'CAS:Login:SignInTooltip' => 'Kattintson ide az azonosításhoz a CAS szerveren',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('IT IT', 'Italian', 'Italiano', array(
Dict::Add('IT IT', 'Italian', 'Italiano', [
'CAS:Error:UserNotAllowed' => 'Utente non autorizzato',
'CAS:Login:SignIn' => 'Accedi con CAS',
'CAS:Login:SignInTooltip' => 'Clicca qui per autenticarti con il server CAS',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('JA JP', 'Japanese', '日本語', array(
Dict::Add('JA JP', 'Japanese', '日本語', [
'CAS:Error:UserNotAllowed' => 'User not allowed~~',
'CAS:Login:SignIn' => 'Sign in with CAS~~',
'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~',
));
]);

View File

@@ -1,17 +1,18 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Jeffrey Bostoen <info@jeffreybostoen.be> (2018 - 2022)
*
*/
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
Dict::Add('NL NL', 'Dutch', 'Nederlands', [
'CAS:Error:UserNotAllowed' => 'Gebruiker heeft onvoldoende rechten.',
'CAS:Login:SignIn' => 'Inloggen met CAS',
'CAS:Login:SignInTooltip' => 'Klik hier om aan te melden via de CAS-server',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PL PL', 'Polish', 'Polski', array(
Dict::Add('PL PL', 'Polish', 'Polski', [
'CAS:Error:UserNotAllowed' => 'Użytkownik niedozwolony',
'CAS:Login:SignIn' => 'Zaloguj się za pomocą CAS',
'CAS:Login:SignInTooltip' => 'Kliknij tutaj, aby uwierzytelnić się na serwerze CAS',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
'CAS:Error:UserNotAllowed' => 'Usuário não permitido',
'CAS:Login:SignIn' => 'Autenticar com CAS',
'CAS:Login:SignInTooltip' => 'Clique aqui para se autenticar no servidor CAS',
));
]);

View File

@@ -1,17 +1,18 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Vladimir Kunin <v.b.kunin@gmail.com>
*
*/
Dict::Add('RU RU', 'Russian', 'Русский', array(
Dict::Add('RU RU', 'Russian', 'Русский', [
'CAS:Error:UserNotAllowed' => 'Вход не разрешён',
'CAS:Login:SignIn' => 'Вход через CAS',
'CAS:Login:SignInTooltip' => 'Нажмите здесь, чтобы войти через CAS сервер',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
'CAS:Error:UserNotAllowed' => 'User not allowed~~',
'CAS:Login:SignIn' => 'Sign in with CAS~~',
'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
Dict::Add('TR TR', 'Turkish', 'Türkçe', [
'CAS:Error:UserNotAllowed' => 'User not allowed~~',
'CAS:Login:SignIn' => 'Sign in with CAS~~',
'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~',
));
]);

View File

@@ -1,12 +1,13 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
Dict::Add('ZH CN', 'Chinese', '简体中文', [
'CAS:Error:UserNotAllowed' => '用户被禁止登录',
'CAS:Login:SignIn' => '使用CAS登录',
'CAS:Login:SignInTooltip' => '点击这里使用CAS服务器认证',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
//
// iTop module definition file
//
@@ -6,7 +7,7 @@
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'authent-cas/3.2.1',
array(
[
// Identification
//
'label' => 'CAS SSO',
@@ -14,36 +15,36 @@ SetupWebPage::AddModule(
// Setup
//
'dependencies' => array(
),
'dependencies' => [
],
'mandatory' => true,
'visible' => true,
// Components
//
'datamodel' => array(
'datamodel' => [
'vendor/autoload.php',
'src/CASLoginExtension.php',
),
'webservice' => array(
),
'data.struct' => array(
],
'webservice' => [
],
'data.struct' => [
// add your 'structure' definition XML files here,
),
'data.sample' => array(
],
'data.sample' => [
// add your sample data XML files here,
),
],
// Documentation
//
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
'doc.more_information' => '', // hyperlink to more information, if any
'doc.more_information' => '', // hyperlink to more information, if any
// Default settings
//
'settings' => array(
'settings' => [
// Authentication
'cas_debug' => false,
'cas_host' => '',
@@ -51,6 +52,6 @@ SetupWebPage::AddModule(
'cas_context' => '',
'cas_version' => '',
'service_base_url' => '',
),
)
],
]
);

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -10,8 +11,7 @@ use LogAPI;
class CASLog extends LogAPI
{
const CHANNEL_DEFAULT = 'CASLog';
public const CHANNEL_DEFAULT = 'CASLog';
protected static $m_oFileLog = null;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
@@ -29,53 +30,53 @@ class CASLogger implements LoggerInterface
LogLevel::DEBUG => LogAPI::LEVEL_DEBUG,
];
public function emergency($message, array $context = array()):void
public function emergency($message, array $context = []): void
{
CASLog::Error('EMERGENCY: '.$message, CASLog::CHANNEL_DEFAULT, $context);
IssueLog::Error('EMERGENCY: '.$message, CASLog::CHANNEL_DEFAULT, $context);
}
public function alert($message, array $context = array()):void
public function alert($message, array $context = []): void
{
CASLog::Error('ALERT: '.$message, CASLog::CHANNEL_DEFAULT, $context);
IssueLog::Error('ALERT: '.$message, CASLog::CHANNEL_DEFAULT, $context);
}
public function critical($message, array $context = array()):void
public function critical($message, array $context = []): void
{
CASLog::Error('CRITICAL: '.$message, CASLog::CHANNEL_DEFAULT, $context);
IssueLog::Error('CRITICAL: '.$message, CASLog::CHANNEL_DEFAULT, $context);
}
public function error($message, array $context = array()):void
public function error($message, array $context = []): void
{
CASLog::Error('ERROR: '.$message, CASLog::CHANNEL_DEFAULT, $context);
IssueLog::Error('ERROR: '.$message, CASLog::CHANNEL_DEFAULT, $context);
}
public function warning($message, array $context = array()):void
public function warning($message, array $context = []): void
{
CASLog::Warning('WARNING: '.$message, CASLog::CHANNEL_DEFAULT, $context);
}
public function notice($message, array $context = array()):void
public function notice($message, array $context = []): void
{
CASLog::Info('NOTICE: '.$message, CASLog::CHANNEL_DEFAULT, $context);
}
public function info($message, array $context = array()):void
public function info($message, array $context = []): void
{
CASLog::Info('INFO: '.$message, CASLog::CHANNEL_DEFAULT, $context);
}
public function debug($message, array $context = array()):void
public function debug($message, array $context = []): void
{
CASLog::Debug('DEBUG: '.$message, CASLog::CHANNEL_DEFAULT, $context);
}
public function log($level, $message, array $context = array()):void
public function log($level, $message, array $context = []): void
{
$sLevel = self::LEVEL_COMPAT[$level] ?? LogAPI::LEVEL_ERROR;
CASLog::Log($sLevel, strtoupper($level).": $message", CASLog::CHANNEL_DEFAULT, $context);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://www.combodo.com/documentation/combodo-software-license.html
@@ -29,7 +30,7 @@ use utils;
*/
class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExtension, iLoginUIExtension
{
const LOGIN_MODE = 'cas';
public const LOGIN_MODE = 'cas';
/**
* Return the list of supported login modes for this plugin
@@ -38,7 +39,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
*/
public function ListSupportedLoginModes()
{
return array(static::LOGIN_MODE);
return [static::LOGIN_MODE];
}
protected function OnStart(&$iErrorCode)
@@ -54,23 +55,16 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
if (empty(Session::Get('login_mode')) || Session::Get('login_mode') == static::LOGIN_MODE)
{
if (empty(Session::Get('login_mode')) || Session::Get('login_mode') == static::LOGIN_MODE) {
static::InitCASClient();
if (phpCAS::isAuthenticated())
{
if (phpCAS::isAuthenticated()) {
Session::Set('login_mode', static::LOGIN_MODE);
Session::Set('auth_user', phpCAS::getUser());
Session::Unset('login_will_redirect');
}
else
{
if (!Session::IsSet('login_will_redirect'))
{
} else {
if (!Session::IsSet('login_will_redirect')) {
Session::Set('login_will_redirect', true);
}
else
{
} else {
Session::Unset('login_will_redirect');
$iErrorCode = LoginWebPage::EXIT_CODE_MISSINGLOGIN;
return LoginWebPage::LOGIN_FSM_ERROR;
@@ -84,15 +78,12 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnCheckCredentials(&$iErrorCode)
{
if (Session::Get('login_mode') == static::LOGIN_MODE)
{
if (!Session::IsSet('auth_user'))
{
if (Session::Get('login_mode') == static::LOGIN_MODE) {
if (!Session::IsSet('auth_user')) {
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
if (Config::Get('cas_user_synchro' ))
{
if (Config::Get('cas_user_synchro')) {
self::DoUserProvisioning(Session::Get('auth_user'));
}
}
@@ -101,11 +92,9 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnCredentialsOK(&$iErrorCode)
{
if (Session::Get('login_mode') == static::LOGIN_MODE)
{
if (Session::Get('login_mode') == static::LOGIN_MODE) {
$sAuthUser = Session::Get('auth_user');
if (!LoginWebPage::CheckUser($sAuthUser))
{
if (!LoginWebPage::CheckUser($sAuthUser)) {
$iErrorCode = LoginWebPage::EXIT_CODE_NOTAUTHORIZED;
return LoginWebPage::LOGIN_FSM_ERROR;
}
@@ -116,15 +105,13 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnError(&$iErrorCode)
{
if (Session::Get('login_mode') == static::LOGIN_MODE)
{
if (Session::Get('login_mode') == static::LOGIN_MODE) {
Session::Unset('phpCAS');
if (LoginWebPage::getIOnExit() === LoginWebPage::EXIT_RETURN) {
// don't display the login page
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
if ($iErrorCode != LoginWebPage::EXIT_CODE_MISSINGLOGIN)
{
if ($iErrorCode != LoginWebPage::EXIT_CODE_MISSINGLOGIN) {
$oLoginWebPage = new LoginWebPage();
$oLoginWebPage->DisplayLogoutPage(false, Dict::S('CAS:Error:UserNotAllowed'));
exit();
@@ -135,8 +122,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
protected function OnConnected(&$iErrorCode)
{
if (Session::Get('login_mode') == static::LOGIN_MODE)
{
if (Session::Get('login_mode') == static::LOGIN_MODE) {
Session::Set('can_logoff', true);
return LoginWebPage::CheckLoggedUser($iErrorCode);
}
@@ -149,8 +135,7 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
public function LogoutAction()
{
$sCASLogoutUrl = Config::Get('cas_logout_redirect_service');
if (empty($sCASLogoutUrl))
{
if (empty($sCASLogoutUrl)) {
$sCASLogoutUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php';
}
static::InitCASClient();
@@ -193,8 +178,8 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
// explode the host list separated by comma and use the first host
$hosts = explode(',', $_SERVER['HTTP_X_FORWARDED_HOST']);
// see rfc7239#5.3 and rfc7230#2.7.1: port is in HTTP_X_FORWARDED_HOST if non default
return $protocol . $hosts[0];
} else if (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) {
return $protocol.$hosts[0];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_SERVER'])) {
$server_url = $_SERVER['HTTP_X_FORWARDED_SERVER'];
} else {
if (empty($_SERVER['SERVER_NAME'])) {
@@ -214,23 +199,20 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
$server_url .= ':';
$server_url .= $server_port;
}
return $protocol . $server_url;
return $protocol.$server_url;
}
private function DoUserProvisioning($sLogin)
{
$bCASUserSynchro = Config::Get('cas_user_synchro');
if (!$bCASUserSynchro)
{
if (!$bCASUserSynchro) {
return;
}
CMDBObject::SetTrackInfo('CAS/LDAP Synchro');
$oUser = LoginWebPage::FindUser($sLogin, false);
if ($oUser)
{
if ($oUser->Get('status') == 'enabled')
{
if ($oUser) {
if ($oUser->Get('status') == 'enabled') {
CASUserProvisioning::UpdateUser($oUser);
}
return;
@@ -246,11 +228,11 @@ class CASLoginExtension extends AbstractLoginFSMExtension implements iLogoutExte
$oLoginContext = new LoginTwigContext();
$oLoginContext->SetLoaderPath(APPROOT.'env-'.utils::GetCurrentEnvironment().'/authent-cas/view');
$aData = array(
$aData = [
'sLoginMode' => static::LOGIN_MODE,
'sLabel' => Dict::S('CAS:Login:SignIn'),
'sTooltip' => Dict::S('CAS:Login:SignInTooltip'),
);
];
$oLoginContext->AddBlockExtension('login_sso_buttons', new LoginBlockExtension('cas_sso_button.html.twig', $aData));
return $oLoginContext;
@@ -284,84 +266,66 @@ class CASUserProvisioning
$sCASMemberships = Config::Get('cas_memberof');
$bFound = false;
if (!empty($sCASMemberships))
{
if (!empty($sCASMemberships)) {
$sCASMemberOfName = Config::Get('cas_memberof_attribute_name', 'memberOf');
if (phpCAS::hasAttribute($sCASMemberOfName))
{
if (phpCAS::hasAttribute($sCASMemberOfName)) {
// A list of groups is specified, the user must a be member of (at least) one of them to pass
$aCASMemberships = array();
$aCASMemberships = [];
$aTmp = explode(';', $sCASMemberships);
setlocale(LC_ALL, "en_US.utf8"); // !!! WARNING: this is needed to have the iconv //TRANSLIT working fine below !!!
foreach($aTmp as $sGroupName)
{
foreach ($aTmp as $sGroupName) {
$aCASMemberships[] = trim(iconv('UTF-8', 'ASCII//TRANSLIT', $sGroupName)); // Just in case remove accents and spaces...
}
$aMemberOf = phpCAS::getAttribute($sCASMemberOfName);
if (!is_array($aMemberOf)) $aMemberOf = array($aMemberOf); // Just one entry, turn it into an array
$aFilteredGroupNames = array();
foreach($aMemberOf as $sGroupName)
{
if (!is_array($aMemberOf)) {
$aMemberOf = [$aMemberOf];
} // Just one entry, turn it into an array
$aFilteredGroupNames = [];
foreach ($aMemberOf as $sGroupName) {
phpCAS::log("Info: user if a member of the group: ".$sGroupName);
$sGroupName = trim(iconv('UTF-8', 'ASCII//TRANSLIT', $sGroupName)); // Remove accents and spaces as well
$aFilteredGroupNames[] = $sGroupName;
$bIsMember = false;
foreach($aCASMemberships as $sCASPattern)
{
if (self::IsPattern($sCASPattern))
{
if (preg_match($sCASPattern, $sGroupName))
{
foreach ($aCASMemberships as $sCASPattern) {
if (self::IsPattern($sCASPattern)) {
if (preg_match($sCASPattern, $sGroupName)) {
$bIsMember = true;
break;
}
}
else if ($sCASPattern == $sGroupName)
{
} elseif ($sCASPattern == $sGroupName) {
$bIsMember = true;
break;
}
}
if ($bIsMember)
{
if ($bIsMember) {
// If needed create a new user for this email/profile
$bOk = self::CreateCASUser(phpCAS::getUser(), $aMemberOf);
if($bOk)
{
if ($bOk) {
$bFound = true;
}
else
{
} else {
phpCAS::log("User ".phpCAS::getUser()." cannot be created in iTop. Logging off...");
}
break;
}
}
if($bOk && !$bFound)
{
if ($bOk && !$bFound) {
phpCAS::log("User ".phpCAS::getUser().", none of his/her groups (".implode('; ', $aFilteredGroupNames).") match any of the required groups: ".implode('; ', $aCASMemberships));
}
}
else
{
} else {
// Too bad, the user is not part of any of the group => not allowed
phpCAS::log("No '$sCASMemberOfName' attribute found for user ".phpCAS::getUser().". Are you using the SAML protocol (S1) ?");
}
}
else
{
} else {
// No membership: no way to create the user that should exist prior to authentication
phpCAS::log("User ".phpCAS::getUser().": missing user account in iTop (or iTop badly configured, Cf setting cas_memberof)");
$bFound = false;
}
if (!$bFound)
{
if (!$bFound) {
// The user is not part of the allowed groups, => log out
$sCASLogoutUrl = Config::Get('cas_logout_redirect_service');
if (empty($sCASLogoutUrl))
{
if (empty($sCASLogoutUrl)) {
$sCASLogoutUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php';
}
phpCAS::logoutWithRedirectService($sCASLogoutUrl); // Redirects to the CAS logout page
@@ -385,10 +349,11 @@ class CASUserProvisioning
{
$bCASUpdateProfiles = Config::Get('cas_update_profiles');
$sCASMemberOfName = Config::Get('cas_memberof_attribute_name', 'memberOf');
if ($bCASUpdateProfiles && (phpCAS::hasAttribute($sCASMemberOfName)))
{
if ($bCASUpdateProfiles && (phpCAS::hasAttribute($sCASMemberOfName))) {
$aMemberOf = phpCAS::getAttribute($sCASMemberOfName);
if (!is_array($aMemberOf)) $aMemberOf = array($aMemberOf); // Just one entry, turn it into an array
if (!is_array($aMemberOf)) {
$aMemberOf = [$aMemberOf];
} // Just one entry, turn it into an array
self::SetProfilesFromCAS($oUser, $aMemberOf);
}
@@ -410,30 +375,24 @@ class CASUserProvisioning
*/
protected static function CreateCASUser($sLogin, $aGroups)
{
if (!MetaModel::IsValidClass('URP_Profiles'))
{
if (!MetaModel::IsValidClass('URP_Profiles')) {
phpCAS::log("URP_Profiles is not a valid class. Automatic creation of Users is not supported in this context, sorry.");
return false;
}
$oUser = MetaModel::GetObjectByName('UserExternal', $sLogin, false);
if ($oUser == null)
{
if ($oUser == null) {
// Create the user, link it to a contact
if (phpCAS::hasAttribute('mail'))
{
if (phpCAS::hasAttribute('mail')) {
$sEmail = phpCAS::getAttribute('mail');
}
else
{
} else {
$sEmail = $sLogin;
}
phpCAS::log("Info: the user '$sLogin' does not exist. A new UserExternal will be created.");
$oSearch = new DBObjectSearch('Person');
$oSearch->AddCondition('email', $sEmail);
$oSet = new DBObjectSet($oSearch);
switch($oSet->Count())
{
switch ($oSet->Count()) {
case 0:
phpCAS::log("Error: found no contact with the email: '$sEmail'. Cannot create the user in iTop.");
return false;
@@ -453,9 +412,7 @@ class CASUserProvisioning
$oUser->Set('login', $sLogin);
$oUser->Set('contactid', $iContactId);
$oUser->Set('language', MetaModel::GetConfig()->GetDefaultLanguage());
}
else
{
} else {
phpCAS::log("Info: the user '$sLogin' already exists (id=".$oUser->GetKey().").");
}
@@ -474,8 +431,7 @@ class CASUserProvisioning
*/
protected static function SetProfilesFromCAS($oUser, $aGroups)
{
if (!MetaModel::IsValidClass('URP_Profiles'))
{
if (!MetaModel::IsValidClass('URP_Profiles')) {
phpCAS::log("URP_Profiles is not a valid class. Automatic creation of Users is not supported in this context, sorry.");
return false;
}
@@ -483,56 +439,42 @@ class CASUserProvisioning
// read all the existing profiles
$oProfilesSearch = new DBObjectSearch('URP_Profiles');
$oProfilesSet = new DBObjectSet($oProfilesSearch);
$aAllProfiles = array();
while($oProfile = $oProfilesSet->Fetch())
{
$aAllProfiles = [];
while ($oProfile = $oProfilesSet->Fetch()) {
$aAllProfiles[mb_strtolower($oProfile->GetName())] = $oProfile->GetKey();
}
// Translate the CAS/LDAP group names into iTop profile names
$aProfiles = array();
$aProfiles = [];
$sPattern = Config::Get('cas_profile_pattern');
foreach($aGroups as $sGroupName)
{
if (preg_match($sPattern, $sGroupName, $aMatches))
{
if (array_key_exists(mb_strtolower($aMatches[1]), $aAllProfiles))
{
foreach ($aGroups as $sGroupName) {
if (preg_match($sPattern, $sGroupName, $aMatches)) {
if (array_key_exists(mb_strtolower($aMatches[1]), $aAllProfiles)) {
$aProfiles[] = $aAllProfiles[mb_strtolower($aMatches[1])];
phpCAS::log("Info: Adding the profile '{$aMatches[1]}' from CAS.");
}
else
{
} else {
phpCAS::log("Warning: {$aMatches[1]} is not a valid iTop profile (extracted from group name: '$sGroupName'). Ignored.");
}
}
else
{
} else {
phpCAS::log("Info: The CAS group '$sGroupName' does not seem to match an iTop pattern. Ignored.");
}
}
if (count($aProfiles) == 0)
{
if (count($aProfiles) == 0) {
phpCAS::log("Info: The user '".$oUser->GetName()."' has no profiles retrieved from CAS. Default profile(s) will be used.");
// Second attempt: check if there is/are valid default profile(s)
$sCASDefaultProfiles = Config::Get('cas_default_profiles');
$aCASDefaultProfiles = explode(';', $sCASDefaultProfiles);
foreach($aCASDefaultProfiles as $sDefaultProfileName)
{
if (array_key_exists(mb_strtolower($sDefaultProfileName), $aAllProfiles))
{
foreach ($aCASDefaultProfiles as $sDefaultProfileName) {
if (array_key_exists(mb_strtolower($sDefaultProfileName), $aAllProfiles)) {
$aProfiles[] = $aAllProfiles[mb_strtolower($sDefaultProfileName)];
phpCAS::log("Info: Adding the default profile '".$aAllProfiles[mb_strtolower($sDefaultProfileName)]."' from CAS.");
}
else
{
} else {
phpCAS::log("Warning: the default profile {$sDefaultProfileName} is not a valid iTop profile. Ignored.");
}
}
if (count($aProfiles) == 0)
{
if (count($aProfiles) == 0) {
phpCAS::log("Error: The user '".$oUser->GetName()."' has no profiles in iTop, and therefore cannot be created.");
return false;
}
@@ -542,8 +484,7 @@ class CASUserProvisioning
LoginWebPage::SynchronizeProfiles($oUser, $aProfiles, 'CAS/LDAP Synchro');
phpCAS::log("Info: the user '".$oUser->GetName()."' (id=".$oUser->GetKey().") now has the following profiles: '".implode("', '", $aProfiles)."'.");
if ($oUser->IsModified())
{
if ($oUser->IsModified()) {
$oUser->DBWrite();
}
@@ -557,13 +498,10 @@ class CASUserProvisioning
*/
protected static function IsPattern($sCASPattern)
{
if ((substr($sCASPattern, 0, 1) == '/') && (substr($sCASPattern, -1) == '/'))
{
if ((substr($sCASPattern, 0, 1) == '/') && (substr($sCASPattern, -1) == '/')) {
// the string is enclosed by slashes, let's assume it's a pattern
return true;
}
else
{
} else {
return false;
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://www.combodo.com/documentation/combodo-software-license.html
@@ -23,15 +24,13 @@ class Config
public static function Get($sName, $sDefaultValue = '')
{
$sValue = MetaModel::GetModuleSetting('authent-cas', $sName, '');
if (empty($sValue))
{
if (empty($sValue)) {
$sValue = MetaModel::GetConfig()->Get($sName);
}
if (empty($sValue))
{
if (empty($sValue)) {
return $sDefaultValue;
}
return $sValue;
}
}
}

View File

@@ -1,17 +1,18 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Lukáš Dvořák <lukas.dvorak@itopportal.cz>
* @author Daniel Rokos <daniel.rokos@itopportal.cz>
*
*/
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
Dict::Add('CS CZ', 'Czech', 'Čeština', [
'Class:UserExternal' => 'Externí uživatel',
'Class:UserExternal+' => 'Uživatel definovaný mimo '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Erik Bøg <erik@boegmoeller.dk>
*
*/
Dict::Add('DA DA', 'Danish', 'Dansk', array(
Dict::Add('DA DA', 'Danish', 'Dansk', [
'Class:UserExternal' => 'Extern Bruger',
'Class:UserExternal+' => 'Bruger udenfor '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author ITOMIG GmbH <martin.raenker@itomig.de>
*
*/
Dict::Add('DE DE', 'German', 'Deutsch', array(
Dict::Add('DE DE', 'German', 'Deutsch', [
'Class:UserExternal' => 'Externer Benutzer',
'Class:UserExternal+' => 'Extern authentifizierter '.ITOP_APPLICATION_SHORT.'-Benutzer',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -35,7 +36,7 @@
// Class: UserExternal
//
Dict::Add('EN US', 'English', 'English', array(
Dict::Add('EN US', 'English', 'English', [
'Class:UserExternal' => 'External user',
'Class:UserExternal+' => 'User authentified outside of '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -35,7 +36,7 @@
// Class: UserExternal
//
Dict::Add('EN GB', 'British English', 'British English', array(
Dict::Add('EN GB', 'British English', 'British English', [
'Class:UserExternal' => 'External user',
'Class:UserExternal+' => 'User authentified outside of '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,13 +1,14 @@
<?php
/**
* Spanish Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
* @author Miguel Turrubiates <miguel_tf@yahoo.com>
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
*/
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [
'Class:UserExternal' => 'Usuario externo',
'Class:UserExternal+' => 'Usuario autenticado fuera de '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('FR FR', 'French', 'Français', array(
Dict::Add('FR FR', 'French', 'Français', [
'Class:UserExternal' => 'Utilisateur externe à '.ITOP_APPLICATION_SHORT,
'Class:UserExternal+' => 'Utilisateur authentifié à l\'extérieur de '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
Dict::Add('HU HU', 'Hungarian', 'Magyar', [
'Class:UserExternal' => 'Külső felhasználó',
'Class:UserExternal+' => '',
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('IT IT', 'Italian', 'Italiano', array(
Dict::Add('IT IT', 'Italian', 'Italiano', [
'Class:UserExternal' => 'Esterno utente',
'Class:UserExternal+' => 'Utente autenticato al di fuori di '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Hirofumi Kosaka <kosaka@rworks.jp>
*
*/
Dict::Add('JA JP', 'Japanese', '日本語', array(
Dict::Add('JA JP', 'Japanese', '日本語', [
'Class:UserExternal' => '外部ユーザー',
'Class:UserExternal+' => '外部認証ユーザー',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Jeffrey Bostoen <info@jeffreybostoen.be> (2018 - 2022)
*
*/
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
Dict::Add('NL NL', 'Dutch', 'Nederlands', [
'Class:UserExternal' => 'Externe gebruiker',
'Class:UserExternal+' => 'Gebruiker aangemeld via externe authenticatie',
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PL PL', 'Polish', 'Polski', array(
Dict::Add('PL PL', 'Polish', 'Polski', [
'Class:UserExternal' => 'Użytkownik zewnętrzny',
'Class:UserExternal+' => 'Użytkownik uwierzytelniony poza '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
'Class:UserExternal' => 'Usuário externo',
'Class:UserExternal+' => '',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Vladimir Kunin <v.b.kunin@gmail.com>
*
*/
Dict::Add('RU RU', 'Russian', 'Русский', array(
Dict::Add('RU RU', 'Russian', 'Русский', [
'Class:UserExternal' => 'Внешний пользователь',
'Class:UserExternal+' => 'Пользователь, аутентифицируемый вне '.ITOP_APPLICATION_SHORT,
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
'Class:UserExternal' => 'Externý užívateľ',
'Class:UserExternal+' => 'User authentified outside of '.ITOP_APPLICATION_SHORT.'~~',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Izzet Sirin <izzet.sirin@htr.com.tr>
*
*/
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
Dict::Add('TR TR', 'Turkish', 'Türkçe', [
'Class:UserExternal' => 'Harici kullanıcı',
'Class:UserExternal+' => ITOP_APPLICATION_SHORT.' dışında yetki kontrolü yapılan kullanıcı',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -34,7 +35,7 @@
//
// Class: UserExternal
//
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
Dict::Add('ZH CN', 'Chinese', '简体中文', [
'Class:UserExternal' => '外部用户',
'Class:UserExternal+' => '用户在'.ITOP_APPLICATION_SHORT.'外部验证身份',
));
]);

View File

@@ -1,9 +1,10 @@
<?php
// Copyright (C) 2010-2024 Combodo SAS
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// 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.
@@ -16,7 +17,6 @@
// 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
@@ -30,44 +30,44 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
class UserExternal extends User
{
public static function Init()
{
$aParams = array
(
$aParams =
[
"category" => "addon/authentication,grant_by_profile,silo",
"key_type" => "autoincrement",
"name_attcode" => "login",
"state_attcode" => "",
"reconc_keys" => array('login'),
"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',
array(
MetaModel::Init_SetZListItems(
'details',
[
'col:col1' =>
array(
'fieldset:User:info' => array('contactid', 'org_id', 'email', 'login', 'language', 'status'),
),
[
'fieldset:User:info' => ['contactid', 'org_id', 'email', 'login', 'language', 'status'],
],
'col:col2' =>
array(
'fieldset:User:profiles' => array('profile_list'),
),
[
'fieldset:User:profiles' => ['profile_list'],
],
'allowed_org_list',
'log',
)
]
); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('first_name', 'last_name', 'login', 'status')); // Attributes to be displayed for a list
MetaModel::Init_SetZListItems('list', ['first_name', 'last_name', 'login', 'status']); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid', 'status', 'org_id')); // Criteria of the std search form
MetaModel::Init_SetZListItems('advanced_search', array('login', 'contactid', 'status', 'org_id')); // Criteria of the advanced search form
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
}
/**
@@ -97,6 +97,3 @@ class UserExternal extends User
return false;
}
}
?>

View File

@@ -1,9 +1,10 @@
<?php
// Copyright (C) 2010-2024 Combodo SAS
//
// This file is part of iTop.
//
// iTop is free software; you can redistribute it and/or modify
// 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.
@@ -16,7 +17,6 @@
// 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
* Module definition file for the "External Authentication" module
@@ -28,7 +28,7 @@
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'authent-external/3.2.1',
array(
[
// Identification
//
'label' => 'External user authentication',
@@ -36,23 +36,23 @@ SetupWebPage::AddModule(
// Setup
//
'dependencies' => array(
),
'dependencies' => [
],
'mandatory' => false,
'visible' => true,
// Components
//
'datamodel' => array(
'datamodel' => [
'model.authent-external.php',
),
'data.struct' => array(
],
'data.struct' => [
//'data.struct.authent-ldap.xml',
),
'data.sample' => array(
],
'data.sample' => [
//'data.sample.authent-ldap.xml',
),
],
// Documentation
//
'doc.manual_setup' => '',
@@ -60,6 +60,6 @@ SetupWebPage::AddModule(
// Default settings
//
'settings' => array(),
)
'settings' => [],
]
);

View File

@@ -1,27 +1,28 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Lukáš Dvořák <lukas.dvorak@itopportal.cz>
* @author Daniel Rokos <daniel.rokos@itopportal.cz>
*
*/
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
Dict::Add('CS CZ', 'Czech', 'Čeština', [
'Class:UserLDAP' => 'LDAP uživatel',
'Class:UserLDAP+' => 'Uživatel ověřen přes LDAP',
'UserLDAP:server' => 'Specifika LDAP',
));
]);
//
// Class: UserLDAP
//
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
Dict::Add('CS CZ', 'Czech', 'Čeština', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,26 +1,27 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Erik Bøg <erik@boegmoeller.dk>
*
*/
Dict::Add('DA DA', 'Danish', 'Dansk', array(
Dict::Add('DA DA', 'Danish', 'Dansk', [
'Class:UserLDAP' => 'LDAP-Bruger',
'Class:UserLDAP+' => 'Bruger der godkendes via LDAP',
'UserLDAP:server' => 'LDAP specifics~~',
));
]);
//
// Class: UserLDAP
//
Dict::Add('DA DA', 'Danish', 'Dansk', array(
Dict::Add('DA DA', 'Danish', 'Dansk', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,26 +1,27 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author ITOMIG GmbH <martin.raenker@itomig.de>
*
*/
Dict::Add('DE DE', 'German', 'Deutsch', array(
Dict::Add('DE DE', 'German', 'Deutsch', [
'Class:UserLDAP' => 'LDAP-Benutzer',
'Class:UserLDAP+' => 'Benutzer, der via LDAP authentifiziert wird',
'UserLDAP:server' => 'LDAP-Einstellungen',
));
]);
//
// Class: UserLDAP
//
Dict::Add('DE DE', 'German', 'Deutsch', array(
Dict::Add('DE DE', 'German', 'Deutsch', [
'Class:UserLDAP/Attribute:ldap_server' => 'LDAP-Server',
'Class:UserLDAP/Attribute:ldap_server+' => 'Optional: LDAP-Server, der zur Authentifizierung verwendet werden soll, falls mehrere LDAP-Server konfiguriert sind.',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -35,17 +36,17 @@
// Class: UserLDAP
//
Dict::Add('EN US', 'English', 'English', array(
Dict::Add('EN US', 'English', 'English', [
'Class:UserLDAP' => 'LDAP user',
'Class:UserLDAP+' => 'User authenticated by LDAP',
'UserLDAP:server' => 'LDAP specifics',
));
]);
//
// Class: UserLDAP
//
Dict::Add('EN US', 'English', 'English', array(
Dict::Add('EN US', 'English', 'English', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server',
'Class:UserLDAP/Attribute:ldap_server+' => '',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -35,8 +36,8 @@
// Class: UserLDAP
//
Dict::Add('EN GB', 'British English', 'British English', array(
Dict::Add('EN GB', 'British English', 'British English', [
'Class:UserLDAP' => 'LDAP user',
'Class:UserLDAP+' => 'User authenticated by LDAP',
'UserLDAP:server' => 'LDAP specifics',
));
]);

View File

@@ -1,23 +1,24 @@
<?php
/**
* Spanish Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
* @author Miguel Turrubiates <miguel_tf@yahoo.com>
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
*/
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [
'Class:UserLDAP' => 'Usuario LDAP',
'Class:UserLDAP+' => 'Usuario autenticado vía LDAP',
'UserLDAP:server' => 'Especificaciones LDAP',
));
]);
//
// Class: UserLDAP
//
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,25 +1,26 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('FR FR', 'French', 'Français', array(
Dict::Add('FR FR', 'French', 'Français', [
'Class:UserLDAP' => 'Utilisateur LDAP',
'Class:UserLDAP+' => 'Utilisateur authentifié par un serveur LDAP',
'UserLDAP:server' => 'Champs spécifiques pour LDAP',
));
]);
//
// Class: UserLDAP
//
Dict::Add('FR FR', 'French', 'Français', array(
Dict::Add('FR FR', 'French', 'Français', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,25 +1,26 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
Dict::Add('HU HU', 'Hungarian', 'Magyar', [
'Class:UserLDAP' => 'LDAP felhasználó',
'Class:UserLDAP+' => 'LDAP vagy AD felhasználó',
'UserLDAP:server' => 'LDAP specifics~~',
));
]);
//
// Class: UserLDAP
//
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
Dict::Add('HU HU', 'Hungarian', 'Magyar', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,25 +1,26 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('IT IT', 'Italian', 'Italiano', array(
Dict::Add('IT IT', 'Italian', 'Italiano', [
'Class:UserLDAP' => 'Utente LDAP',
'Class:UserLDAP+' => 'Utente autenticato da LDAP',
'UserLDAP:server' => 'Specifiche LDAP',
));
]);
//
// Class: UserLDAP
//
Dict::Add('IT IT', 'Italian', 'Italiano', array(
Dict::Add('IT IT', 'Italian', 'Italiano', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,26 +1,27 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Hirofumi Kosaka <kosaka@rworks.jp>
*
*/
Dict::Add('JA JP', 'Japanese', '日本語', array(
Dict::Add('JA JP', 'Japanese', '日本語', [
'Class:UserLDAP' => 'LDAP ユーザー',
'Class:UserLDAP+' => 'LDAP認証ユーザー',
'UserLDAP:server' => 'LDAP specifics~~',
));
]);
//
// Class: UserLDAP
//
Dict::Add('JA JP', 'Japanese', '日本語', array(
Dict::Add('JA JP', 'Japanese', '日本語', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,26 +1,27 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Thomas Casteleyn <thomas.casteleyn@super-visions.com>
* @author Jeffrey Bostoen <info@jeffreybostoen.be> (2018 - 2022)
*/
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
Dict::Add('NL NL', 'Dutch', 'Nederlands', [
'Class:UserLDAP' => 'LDAP-gebruiker',
'Class:UserLDAP+' => 'Gebruiker die aanmeldt via LDAP',
'UserLDAP:server' => 'LDAP informatie',
));
]);
//
// Class: UserLDAP
//
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
Dict::Add('NL NL', 'Dutch', 'Nederlands', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,25 +1,26 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PL PL', 'Polish', 'Polski', array(
Dict::Add('PL PL', 'Polish', 'Polski', [
'Class:UserLDAP' => 'Użytkownik LDAP',
'Class:UserLDAP+' => 'Użytkownik uwierzytelniony przez LDAP',
'UserLDAP:server' => 'Serwer LDAP',
));
]);
//
// Class: UserLDAP
//
Dict::Add('PL PL', 'Polish', 'Polski', array(
Dict::Add('PL PL', 'Polish', 'Polski', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,25 +1,26 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
'Class:UserLDAP' => 'Usuário externo via LDAP',
'Class:UserLDAP+' => '',
'UserLDAP:server' => 'LDAP specifics~~',
));
]);
//
// Class: UserLDAP
//
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,26 +1,27 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Vladimir Kunin <v.b.kunin@gmail.com>
*
*/
Dict::Add('RU RU', 'Russian', 'Русский', array(
Dict::Add('RU RU', 'Russian', 'Русский', [
'Class:UserLDAP' => 'Пользователь LDAP',
'Class:UserLDAP+' => 'Пользователь, аутентифицируемый через LDAP',
'UserLDAP:server' => 'LDAP specifics~~',
));
]);
//
// Class: UserLDAP
//
Dict::Add('RU RU', 'Russian', 'Русский', array(
Dict::Add('RU RU', 'Russian', 'Русский', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,25 +1,26 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
'Class:UserLDAP' => 'LDAP užívateľ',
'Class:UserLDAP+' => 'User authenticated by LDAP~~',
'UserLDAP:server' => 'LDAP specifics~~',
));
]);
//
// Class: UserLDAP
//
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,26 +1,27 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Izzet Sirin <izzet.sirin@htr.com.tr>
*
*/
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
Dict::Add('TR TR', 'Turkish', 'Türkçe', [
'Class:UserLDAP' => 'LDAP kullanıcısı',
'Class:UserLDAP+' => 'Yetki kontrolü LDAP tarafından yapılan',
'UserLDAP:server' => 'LDAP specifics~~',
));
]);
//
// Class: UserLDAP
//
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
Dict::Add('TR TR', 'Turkish', 'Türkçe', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -33,17 +34,17 @@
//
// Class: UserLDAP
//
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
Dict::Add('ZH CN', 'Chinese', '简体中文', [
'Class:UserLDAP' => 'LDAP用户',
'Class:UserLDAP+' => '用户身份由LDAP认证',
'UserLDAP:server' => 'LDAP详情',
));
]);
//
// Class: UserLDAP
//
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
Dict::Add('ZH CN', 'Chinese', '简体中文', [
'Class:UserLDAP/Attribute:ldap_server' => 'Ldap server~~',
'Class:UserLDAP/Attribute:ldap_server+' => '~~',
));
]);

View File

@@ -1,80 +1,78 @@
<?php
// Until we develop a mean to adress this within the setup, let's check that this instance
// of PHP has the php_ldap extension
//
if (function_exists('ldap_connect'))
{
if (function_exists('ldap_connect')) {
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'authent-ldap/3.2.1',
array(
// Identification
//
'label' => 'User authentication based on LDAP',
'category' => 'authentication',
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'authent-ldap/3.2.1',
[
// Identification
//
'label' => 'User authentication based on LDAP',
'category' => 'authentication',
// Setup
//
'dependencies' => array(
),
'mandatory' => false,
'visible' => true,
'installer' => 'AuthentLDAPInstaller',
// Setup
//
'dependencies' => [
],
'mandatory' => false,
'visible' => true,
'installer' => 'AuthentLDAPInstaller',
// Components
//
'datamodel' => array(
),
'data.struct' => array(
//'data.struct.authent-ldap.xml',
),
'data.sample' => array(
//'data.sample.authent-ldap.xml',
),
// Documentation
//
'doc.manual_setup' => '',
'doc.more_information' => '',
// Components
//
'datamodel' => [
],
'data.struct' => [
//'data.struct.authent-ldap.xml',
],
'data.sample' => [
//'data.sample.authent-ldap.xml',
],
// Default settings
//
'settings' => array(
'host' => 'localhost', // host or IP address of your LDAP server
'port' => 389, // LDAP port (std: 389)
'default_user' => '', // User and password used for initial "Anonymous" bind to LDAP
'default_pwd' => '', // Leave both blank, if anonymous (read-only) bind is allowed
'base_dn' => 'dc=yourcompany,dc=com', // Base DN for User queries, adjust it to your LDAP schema
'user_query' => '(&(uid=%1$s)(inetuserstatus=ACTIVE))', // Query used to retrieve each user %1$s => iTop login
// For Windows AD use (samaccountname=%1$s) or (userprincipalname=%1$s)
// Some extra LDAP options, refer to: http://www.php.net/manual/en/function.ldap-set-option.php for more info
'options' => array(
LDAP_OPT_PROTOCOL_VERSION => 3,
LDAP_OPT_REFERRALS => 0,
),
'start_tls' => false,
'debug' => false,
'servers' => array(),
),
)
);
// Documentation
//
'doc.manual_setup' => '',
'doc.more_information' => '',
// Module installation handler
//
class AuthentLDAPInstaller extends ModuleInstallerAPI
{
public static function AfterDataLoad(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
// Default settings
//
'settings' => [
'host' => 'localhost', // host or IP address of your LDAP server
'port' => 389, // LDAP port (std: 389)
'default_user' => '', // User and password used for initial "Anonymous" bind to LDAP
'default_pwd' => '', // Leave both blank, if anonymous (read-only) bind is allowed
'base_dn' => 'dc=yourcompany,dc=com', // Base DN for User queries, adjust it to your LDAP schema
'user_query' => '(&(uid=%1$s)(inetuserstatus=ACTIVE))', // Query used to retrieve each user %1$s => iTop login
// For Windows AD use (samaccountname=%1$s) or (userprincipalname=%1$s)
// Some extra LDAP options, refer to: http://www.php.net/manual/en/function.ldap-set-option.php for more info
'options' => [
LDAP_OPT_PROTOCOL_VERSION => 3,
LDAP_OPT_REFERRALS => 0,
],
'start_tls' => false,
'debug' => false,
'servers' => [],
],
]
);
// Module installation handler
//
class AuthentLDAPInstaller extends ModuleInstallerAPI
{
// Create missing table entries
$sUserLDAPTable = MetaModel::DBGetTable('UserLDAP');
$sUserTable = MetaModel::DBGetTable('User');
$sSQL = "insert into $sUserLDAPTable (id) select U.id from $sUserTable as U left join $sUserLDAPTable as L on U.id = L.id where U.finalclass='UserLDAP' and isnull(L.id);";
CMDBSource::Query($sSQL);
public static function AfterDataLoad(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
{
// Create missing table entries
$sUserLDAPTable = MetaModel::DBGetTable('UserLDAP');
$sUserTable = MetaModel::DBGetTable('User');
$sSQL = "insert into $sUserLDAPTable (id) select U.id from $sUserTable as U left join $sUserLDAPTable as L on U.id = L.id where U.finalclass='UserLDAP' and isnull(L.id);";
CMDBSource::Query($sSQL);
}
}
}
} // if (function_exists('ldap_connect'))

View File

@@ -1,17 +1,18 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Lukáš Dvořák <lukas.dvorak@itopportal.cz>
* @author Daniel Rokos <daniel.rokos@itopportal.cz>
*
*/
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
Dict::Add('CS CZ', 'Czech', 'Čeština', [
'Class:UserLocal' => 'interní uživatel '.ITOP_APPLICATION_SHORT,
'Class:UserLocal+' => 'Uživatel ověřen interně v '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Heslo',
@@ -31,4 +32,4 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Heslo musí obsahovat minimálně 8 znaků a musí obsahovat minimálně jedno velké písmeno, jedno malé písmeno, jedno číslo a speciální znak.',
'UserLocal:password:expiration' => 'Níže uvedená pole vyžadují rozšíření',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Nastavení exspirace "Jednorázového hesla" nelze u vlastního účtu uživatele.',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Erik Bøg <erik@boegmoeller.dk>
*
*/
Dict::Add('DA DA', 'Danish', 'Dansk', array(
Dict::Add('DA DA', 'Danish', 'Dansk', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.'-Bruger',
'Class:UserLocal+' => 'Bruger der godkendes af '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Password',
@@ -30,4 +31,4 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~',
'UserLocal:password:expiration' => 'The fields below require an extension~~',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author ITOMIG GmbH <martin.raenker@itomig.de>
*
*/
Dict::Add('DE DE', 'German', 'Deutsch', array(
Dict::Add('DE DE', 'German', 'Deutsch', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.'-Benutzer',
'Class:UserLocal+' => 'Benutzer, der von '.ITOP_APPLICATION_SHORT.' authentifiziert wird',
'Class:UserLocal/Attribute:password' => 'Passwort',
@@ -30,4 +31,4 @@ Dict::Add('DE DE', 'German', 'Deutsch', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Das Passwort entspricht nicht dem in den Konfigurationsregeln hinterlegten RegEx-Ausdruck',
'UserLocal:password:expiration' => 'Die folgenden Felder benötigen eine '.ITOP_APPLICATION_SHORT.' Erweiterung',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Das setzen des Passwortablaufs auf "Einmalpasswort" ist für den eigenen Benutzer nicht erlaubt.',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -35,7 +36,7 @@
// Class: UserLocal
//
Dict::Add('EN US', 'English', 'English', array(
Dict::Add('EN US', 'English', 'English', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.' user',
'Class:UserLocal+' => 'User authentified by '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Password',
@@ -57,4 +58,4 @@ Dict::Add('EN US', 'English', 'English', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.',
'UserLocal:password:expiration' => 'The fields below require an extension',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -35,7 +36,7 @@
// Class: UserLocal
//
Dict::Add('EN GB', 'British English', 'British English', array(
Dict::Add('EN GB', 'British English', 'British English', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.' user',
'Class:UserLocal+' => 'User authentified by '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Password',
@@ -57,4 +58,4 @@ Dict::Add('EN GB', 'British English', 'British English', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.',
'UserLocal:password:expiration' => 'The fields below require an extension',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User',
));
]);

View File

@@ -1,13 +1,14 @@
<?php
/**
* Spanish Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
* @author Miguel Turrubiates <miguel_tf@yahoo.com>
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
*/
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [
'Class:UserLocal' => 'Usuario de '.ITOP_APPLICATION_SHORT,
'Class:UserLocal+' => 'Usuario Autenticado vía '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Contraseña',
@@ -27,4 +28,4 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'La contraseña debe ser de al menos 8 caracteres e incluír mayúsculas, minúsculas, números y caracteres especiales.',
'UserLocal:password:expiration' => 'El siguiente campo requiere una extensión',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Configurar expiración de contraseña para "ontraseña de un solo uso" no está permitido para su propio Usuario',
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('FR FR', 'French', 'Français', array(
Dict::Add('FR FR', 'French', 'Français', [
'Class:UserLocal' => 'Utilisateur '.ITOP_APPLICATION_SHORT,
'Class:UserLocal+' => 'Utilisateur authentifié par '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Mot de passe',
@@ -29,4 +30,4 @@ Dict::Add('FR FR', 'French', 'Français', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Le mot de passe doit contenir au moins 8 caractères, avec minuscule, majuscule, nombre et caractère spécial.',
'UserLocal:password:expiration' => 'Les champs ci-dessous nécessitent une extension',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Impossible de mettre "Usage unique" comme validité du mot de passe pour son propre utilisateur.',
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
Dict::Add('HU HU', 'Hungarian', 'Magyar', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.' felhasználó',
'Class:UserLocal+' => 'Rendszeren belül létrehozott felhasználó',
'Class:UserLocal/Attribute:password' => 'Jelszó',
@@ -29,4 +30,4 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'A jelszónak legalább 8 karakterből kell állnia, és tartalmaznia kell nagybetűket, kisbetűket, numerikus és speciális karaktereket.',
'UserLocal:password:expiration' => 'Az alábbi mezőkhöz egy bővítmény szükséges',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'A jelszó lejárati idejének beállítása "Egyszeri jelszóra" nem engedélyezett a saját Felhasználó számára.',
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('IT IT', 'Italian', 'Italiano', array(
Dict::Add('IT IT', 'Italian', 'Italiano', [
'Class:UserLocal' => 'Utente '.ITOP_APPLICATION_SHORT,
'Class:UserLocal+' => 'Utente autenticato da '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Password',
@@ -29,4 +30,4 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'La password deve essere di almeno 8 caratteri e includere lettere maiuscole, minuscole, numeri e caratteri speciali.',
'UserLocal:password:expiration' => 'I campi sottostanti richiedono un\'estensione',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Impostare la scadenza della password su "Password monouso" non è consentito per il proprio utente',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Hirofumi Kosaka <kosaka@rworks.jp>
*
*/
Dict::Add('JA JP', 'Japanese', '日本語', array(
Dict::Add('JA JP', 'Japanese', '日本語', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.'ユーザー',
'Class:UserLocal+' => ITOP_APPLICATION_SHORT.'ローカル認証ユーザー',
'Class:UserLocal/Attribute:password' => 'パスワード',
@@ -30,4 +31,4 @@ Dict::Add('JA JP', 'Japanese', '日本語', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~',
'UserLocal:password:expiration' => 'The fields below require an extension~~',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Jeffrey Bostoen <info@jeffreybostoen.be> (2018 - 2022)
*
*/
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
Dict::Add('NL NL', 'Dutch', 'Nederlands', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.'-gebruiker',
'Class:UserLocal+' => 'Gebruiker die aanmeldt met gegevens aangemaakt in het gebruikersbeheer van '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Wachtwoord',
@@ -30,4 +31,4 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Het wachtwoord bestaat uit minstens 8 tekens en bestaat uit een mix van minstens 1 hoofdletter, kleine letter, cijfer en speciaal teken.',
'UserLocal:password:expiration' => 'De velden hieronder vereisen een extensie.',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Je kan geen eenmalig wachtwoord instellen voor je eigen gebruiker.',
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PL PL', 'Polish', 'Polski', array(
Dict::Add('PL PL', 'Polish', 'Polski', [
'Class:UserLocal' => 'Użytkownik '.ITOP_APPLICATION_SHORT,
'Class:UserLocal+' => 'Użytkownik uwierzytelniony przez '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Hasło',
@@ -29,4 +30,4 @@ Dict::Add('PL PL', 'Polish', 'Polski', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Hasło musi mieć co najmniej 8 znaków i zawierać duże, małe litery, cyfry i znaki specjalne.',
'UserLocal:password:expiration' => 'Poniższe pola wymagają rozszerzenia',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Ustawienie wygaśnięcia hasła "Hasło jednorazowe" nie jest dozwolone dla własnego użytkownika',
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
'Class:UserLocal' => 'Usuário local',
'Class:UserLocal+' => '',
'Class:UserLocal/Attribute:password' => 'Senha',
@@ -29,4 +30,4 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'A senha deve ter no mínimo 8 caracteres e incluir letras maiúsculas, minúsculas, números e símbolos',
'UserLocal:password:expiration' => 'O campo abaixo requer uma extensão',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Definir a expiração da senha para One-Time Password (OTP) não é permitido para o seu próprio usuário',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Vladimir Kunin <v.b.kunin@gmail.com>
*
*/
Dict::Add('RU RU', 'Russian', 'Русский', array(
Dict::Add('RU RU', 'Russian', 'Русский', [
'Class:UserLocal' => 'Пользователь '.ITOP_APPLICATION_SHORT,
'Class:UserLocal+' => 'Пользователь, аутентифицируемый через '.ITOP_APPLICATION_SHORT,
'Class:UserLocal/Attribute:password' => 'Пароль',
@@ -30,4 +31,4 @@ Dict::Add('RU RU', 'Russian', 'Русский', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Пароль должен содержать не менее 8 символов и включать прописные, строчные, числовые и специальные символы.',
'UserLocal:password:expiration' => 'Поля требуют наличия доп. расширения',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~',
));
]);

View File

@@ -1,15 +1,16 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.' užívateľ',
'Class:UserLocal+' => 'User authentified by '.ITOP_APPLICATION_SHORT.'~~',
'Class:UserLocal/Attribute:password' => 'Heslo',
@@ -29,4 +30,4 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~',
'UserLocal:password:expiration' => 'The fields below require an extension~~',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~',
));
]);

View File

@@ -1,16 +1,17 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
* @author Izzet Sirin <izzet.sirin@htr.com.tr>
*
*/
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
Dict::Add('TR TR', 'Turkish', 'Türkçe', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.' kullanıcısı',
'Class:UserLocal+' => 'Yetki kontorlünü '.ITOP_APPLICATION_SHORT.' tarafından yapılan kullanıcı',
'Class:UserLocal/Attribute:password' => 'Şifre',
@@ -30,4 +31,4 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~',
'UserLocal:password:expiration' => 'The fields below require an extension~~',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -33,7 +34,7 @@
//
// Class: UserLocal
//
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
Dict::Add('ZH CN', 'Chinese', '简体中文', [
'Class:UserLocal' => ITOP_APPLICATION_SHORT.' 用户',
'Class:UserLocal+' => '用户由'.ITOP_APPLICATION_SHORT.'验证身份',
'Class:UserLocal/Attribute:password' => '密码',
@@ -53,4 +54,4 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array(
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => '密码必须至少8个字符, 包含大小写, 数字和特殊字符.',
'UserLocal:password:expiration' => '下面的区域需要插件扩展',
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => '不允许用户为自己设置 "一次性密码" 的失效期限',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
// Copyright (C) 2010-2024 Combodo SAS
//
// This file is part of iTop.
@@ -16,7 +17,6 @@
// 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 Local
* User authentication Module, password stored in the local database
@@ -25,7 +25,6 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
class UserLocalPasswordValidity
{
/** @var bool */
@@ -53,7 +52,6 @@ class UserLocalPasswordValidity
return $this->m_bPasswordValidity;
}
/**
* @return string
*/
@@ -65,55 +63,56 @@ class UserLocalPasswordValidity
class UserLocal extends UserInternal
{
const EXPIRE_CAN = 'can_expire';
const EXPIRE_NEVER = 'never_expire';
const EXPIRE_FORCE = 'force_expire';
const EXPIRE_ONE_TIME_PWD = 'otp_expire';
public const EXPIRE_CAN = 'can_expire';
public const EXPIRE_NEVER = 'never_expire';
public const EXPIRE_FORCE = 'force_expire';
public const EXPIRE_ONE_TIME_PWD = 'otp_expire';
/** @var UserLocalPasswordValidity|null */
protected $m_oPasswordValidity = null;
public static function Init()
{
$aParams = array
(
$aParams =
[
"category" => "addon/authentication,grant_by_profile,silo",
"key_type" => "autoincrement",
"name_attcode" => "login",
"state_attcode" => "",
"reconc_keys" => array('login'),
"reconc_keys" => ['login'],
"db_table" => "priv_user_local",
"db_key_field" => "id",
"db_finalclass_field" => "",
);
];
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeOneWayPassword("password", array("allowed_values"=>null, "sql"=>"pwd", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeOneWayPassword("password", ["allowed_values" => null, "sql" => "pwd", "default_value" => null, "is_null_allowed" => false, "depends_on" => []]));
$sExpireEnum = implode(',', array(self::EXPIRE_CAN, self::EXPIRE_NEVER, self::EXPIRE_FORCE, self::EXPIRE_ONE_TIME_PWD));
MetaModel::Init_AddAttribute(new AttributeEnum("expiration", array("allowed_values"=>new ValueSetEnum($sExpireEnum), "sql"=>"expiration", "default_value"=>self::EXPIRE_NEVER, "is_null_allowed"=>false, "depends_on"=>array())));
MetaModel::Init_AddAttribute(new AttributeDate("password_renewed_date", array("allowed_values"=>null, "sql"=>"password_renewed_date", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
$sExpireEnum = implode(',', [self::EXPIRE_CAN, self::EXPIRE_NEVER, self::EXPIRE_FORCE, self::EXPIRE_ONE_TIME_PWD]);
MetaModel::Init_AddAttribute(new AttributeEnum("expiration", ["allowed_values" => new ValueSetEnum($sExpireEnum), "sql" => "expiration", "default_value" => self::EXPIRE_NEVER, "is_null_allowed" => false, "depends_on" => []]));
MetaModel::Init_AddAttribute(new AttributeDate("password_renewed_date", ["allowed_values" => null, "sql" => "password_renewed_date", "default_value" => "", "is_null_allowed" => true, "depends_on" => []]));
// Display lists
MetaModel::Init_SetZListItems('details',
array(
MetaModel::Init_SetZListItems(
'details',
[
'col:col1' =>
array(
'fieldset:User:info' => array('contactid', 'org_id', 'email', 'login', 'password', 'language', 'status'),
),
[
'fieldset:User:info' => ['contactid', 'org_id', 'email', 'login', 'password', 'language', 'status'],
],
'col:col2' =>
array(
'fieldset:User:profiles' => array('profile_list',),
'fieldset:UserLocal:password:expiration' => array('expiration', 'password_renewed_date',),
),
[
'fieldset:User:profiles' => ['profile_list',],
'fieldset:UserLocal:password:expiration' => ['expiration', 'password_renewed_date',],
],
'allowed_org_list',
'log',
)
]
); // Attributes to be displayed for the complete details
MetaModel::Init_SetZListItems('list', array('first_name', 'last_name', 'login', 'org_id')); // Attributes to be displayed for a list
MetaModel::Init_SetZListItems('list', ['first_name', 'last_name', 'login', 'org_id']); // Attributes to be displayed for a list
// Search criteria
MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid', 'status', 'org_id')); // Criteria of the std search form
MetaModel::Init_SetZListItems('standard_search', ['login', 'contactid', 'status', 'org_id']); // Criteria of the std search form
}
public function CheckCredentials($sPassword)
@@ -121,8 +120,7 @@ class UserLocal extends UserInternal
$oPassword = $this->Get('password'); // ormPassword object
// Cannot compare directly the values since they are hashed, so
// Let's ask the password to compare the hashed values
if ($oPassword->CheckPassword($sPassword))
{
if ($oPassword->CheckPassword($sPassword)) {
return true;
}
return false;
@@ -135,12 +133,10 @@ class UserLocal extends UserInternal
public function CanChangePassword()
{
if (MetaModel::GetConfig()->Get('demo_mode'))
{
if (MetaModel::GetConfig()->Get('demo_mode')) {
return false;
}
if($this->Get('expiration') == self::EXPIRE_ONE_TIME_PWD)
{
if ($this->Get('expiration') == self::EXPIRE_ONE_TIME_PWD) {
return false;
}
return true;
@@ -152,8 +148,7 @@ class UserLocal extends UserInternal
$oPassword = $this->Get('password');
// Cannot compare directly the values since they are hashed, so
// Let's ask the password to compare the hashed values
if ($oPassword->CheckPassword($sOldPassword))
{
if ($oPassword->CheckPassword($sOldPassword)) {
$this->SetPassword($sNewPassword);
return $this->IsPasswordValid();
}
@@ -173,8 +168,7 @@ class UserLocal extends UserInternal
{
$result = parent::Set($sAttCode, $value);
if ('password' == $sAttCode)
{
if ('password' == $sAttCode) {
$this->ValidatePassword($value);
}
@@ -199,32 +193,28 @@ class UserLocal extends UserInternal
protected function OnWrite()
{
if (array_key_exists('password_renewed_date', $this->ListChanges()))
{
if (array_key_exists('password_renewed_date', $this->ListChanges())) {
return;
}
if (empty($this->m_oPasswordValidity))
{
if (empty($this->m_oPasswordValidity)) {
//password unchanged
if (is_null($this->Get('password_renewed_date')))
{
if (is_null($this->Get('password_renewed_date'))) {
//initialize password_renewed_date with User creation date
$sKey = $this->GetKey();
$sOql = <<<OQL
$sOql = <<<OQL
SELECT CMDBChangeOpCreate AS ccc
JOIN CMDBChange AS c ON ccc.change = c.id
WHERE ccc.objclass="UserLocal" AND ccc.objkey="$sKey"
OQL;
$oCmdbChangeOpSearch = \DBObjectSearch::FromOQL($sOql);
$oSet = new \DBObjectSet($oCmdbChangeOpSearch);
$oCMDBChangeOpCreate = $oSet->Fetch();
if (! is_null($oCMDBChangeOpCreate))
{
$oUserCreationDateTime = \DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $oCMDBChangeOpCreate->Get('date'));
$sCreationDate = $oUserCreationDateTime->format(\AttributeDate::GetInternalFormat());
$this->Set('password_renewed_date', $sCreationDate);
}
$oCmdbChangeOpSearch = \DBObjectSearch::FromOQL($sOql);
$oSet = new \DBObjectSet($oCmdbChangeOpSearch);
$oCMDBChangeOpCreate = $oSet->Fetch();
if (! is_null($oCMDBChangeOpCreate)) {
$oUserCreationDateTime = \DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $oCMDBChangeOpCreate->Get('date'));
$sCreationDate = $oUserCreationDateTime->format(\AttributeDate::GetInternalFormat());
$this->Set('password_renewed_date', $sCreationDate);
}
}
return;
}
@@ -233,10 +223,8 @@ OQL;
$this->Set('password_renewed_date', $sNow);
// Reset the "force" expiration flag when the user updates her/his own password!
if ($this->IsCurrentUser())
{
if (($this->Get('expiration') == self::EXPIRE_FORCE))
{
if ($this->IsCurrentUser()) {
if (($this->Get('expiration') == self::EXPIRE_FORCE)) {
$this->Set('expiration', self::EXPIRE_CAN);
}
}
@@ -244,8 +232,7 @@ OQL;
public function IsPasswordValid()
{
if (ContextTag::Check(ContextTag::TAG_SETUP))
{
if (ContextTag::Check(ContextTag::TAG_SETUP)) {
// during the setup, the admin account can have whatever password you want ...
return true;
}
@@ -253,17 +240,14 @@ OQL;
return (empty($this->m_oPasswordValidity)) || ($this->m_oPasswordValidity->isPasswordValid());
}
public function getPasswordValidityMessage()
{
if (ContextTag::Check(ContextTag::TAG_SETUP))
{
if (ContextTag::Check(ContextTag::TAG_SETUP)) {
// during the setup, the admin account can have whatever password you want ...
return null;
}
if (empty($this->m_oPasswordValidity))
{
if (empty($this->m_oPasswordValidity)) {
return null;
}
@@ -281,30 +265,25 @@ OQL;
*/
public function ValidatePassword($proposedValue, $config = null, $aValidatorCollection = null)
{
if (null == $config)
{
if (null == $config) {
$config = MetaModel::GetConfig();
}
//if the $proposedValue is an ormPassword, then it cannot be checked
//this if is even more permissive as we can only check against strings
if (!is_string($proposedValue) && !empty($proposedValue))
{
if (!is_string($proposedValue) && !empty($proposedValue)) {
$this->m_oPasswordValidity = new UserLocalPasswordValidity(true);
return;
}
if (null == $aValidatorCollection)
{
if (null == $aValidatorCollection) {
$aValidatorCollection = MetaModel::EnumPlugins('iModuleExtension', 'UserLocalPasswordValidator');
}
foreach ($aValidatorCollection as $oUserLocalPasswordValidator)
{
foreach ($aValidatorCollection as $oUserLocalPasswordValidator) {
$this->m_oPasswordValidity = $oUserLocalPasswordValidator->ValidatePassword($proposedValue, $this, $config);
if (!$this->m_oPasswordValidity->isPasswordValid())
{
if (!$this->m_oPasswordValidity->isPasswordValid()) {
return;
}
}
@@ -312,8 +291,7 @@ OQL;
public function DoCheckToWrite()
{
if (! $this->IsPasswordValid())
{
if (! $this->IsPasswordValid()) {
$this->m_aCheckIssues[] = $this->m_oPasswordValidity->getPasswordValidityMessage();
}
@@ -337,13 +315,11 @@ OQL;
* @return integer Flags: the binary combination of the flags applicable to this attribute
* @throws \CoreException
*/
public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '')
public function GetAttributeFlags($sAttCode, &$aReasons = [], $sTargetState = '')
{
$iFlags = parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
if (MetaModel::GetConfig()->Get('demo_mode'))
{
if (strpos('contactid,login,language,password,status,profile_list,allowed_org_list', $sAttCode) !== false)
{
if (MetaModel::GetConfig()->Get('demo_mode')) {
if (strpos('contactid,login,language,password,status,profile_list,allowed_org_list', $sAttCode) !== false) {
// contactid and allowed_org_list are disabled to make sure the portal remains accessible
$aReasons[] = 'Sorry, this attribute is read-only in the demonstration mode!';
$iFlags |= OPT_ATT_READONLY;
@@ -353,8 +329,6 @@ OQL;
}
}
interface UserLocalPasswordValidator extends iModuleExtension
{
/**
@@ -384,42 +358,32 @@ class UserPasswordPolicyRegex implements UserLocalPasswordValidator
{
$sPattern = $config->GetModuleSetting('authent-local', 'password_validation.pattern');
if ('' == $sPattern)
{
if ('' == $sPattern) {
return new UserLocalPasswordValidity(true);
}
$isMatched = preg_match("/{$sPattern}/", $proposedValue);
if ($isMatched === false)
{
if ($isMatched === false) {
return new UserLocalPasswordValidity(
false,
'Unknown error : Failed to check the password.'
);
}
if ($isMatched === 1)
{
if ($isMatched === 1) {
return new UserLocalPasswordValidity(true);
}
$sUserLanguage = Dict::GetUserLanguage();
$customMessages = $config->GetModuleSetting('authent-local', 'password_validation.message', null);
if (is_string($customMessages) )
{
if (is_string($customMessages)) {
$sMessage = $customMessages;
}
elseif (isset($customMessages) && array_key_exists($sUserLanguage, $customMessages))
{
} elseif (isset($customMessages) && array_key_exists($sUserLanguage, $customMessages)) {
$sMessage = $customMessages[$sUserLanguage];
}
elseif (isset($customMessages) && array_key_exists('EN US', $customMessages))
{
} elseif (isset($customMessages) && array_key_exists('EN US', $customMessages)) {
$sMessage = $customMessages['EN US'];
}
else
{
} else {
$sMessage = Dict::S('Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed');
}

View File

@@ -1,10 +1,9 @@
<?php
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'authent-local/3.2.1',
array(
[
// Identification
//
'label' => 'User authentication based on the local DB',
@@ -12,23 +11,23 @@ SetupWebPage::AddModule(
// Setup
//
'dependencies' => array(
),
'dependencies' => [
],
'mandatory' => true,
'visible' => true,
// Components
//
'datamodel' => array(
'datamodel' => [
'model.authent-local.php',
),
'data.struct' => array(
],
'data.struct' => [
//'data.struct.authent-local.xml',
),
'data.sample' => array(
],
'data.sample' => [
//'data.sample.authent-local.xml',
),
],
// Documentation
//
'doc.manual_setup' => '',
@@ -37,8 +36,8 @@ SetupWebPage::AddModule(
// Default settings
//
'settings' => array(
'settings' => [
// see the './datamodel.authent-local.xml' for the default settings!
),
)
],
]
);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
Dict::Add('CS CZ', 'Czech', 'Čeština', [
'theme:darkmoon' => 'Dark moon',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('DA DA', 'Danish', 'Dansk', array(
Dict::Add('DA DA', 'Danish', 'Dansk', [
'theme:darkmoon' => 'Dark moon~~',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('DE DE', 'German', 'Deutsch', array(
Dict::Add('DE DE', 'German', 'Deutsch', [
'theme:darkmoon' => 'Dark moon',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -21,6 +22,6 @@
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('EN US', 'English', 'English', array(
Dict::Add('EN US', 'English', 'English', [
'theme:darkmoon' => 'Dark moon',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -21,6 +22,6 @@
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('EN GB', 'British English', 'British English', array(
Dict::Add('EN GB', 'British English', 'British English', [
'theme:darkmoon' => 'Dark moon',
));
]);

View File

@@ -1,12 +1,13 @@
<?php
/**
* Spanish Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
* @author Miguel Turrubiates <miguel_tf@yahoo.com>
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
* @notas Utilizar codificación UTF-8 para mostrar acentos y otros caracteres especiales
*/
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', [
'theme:darkmoon' => 'Luna Obscura',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('FR FR', 'French', 'Français', array(
Dict::Add('FR FR', 'French', 'Français', [
'theme:darkmoon' => 'Dark moon',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
Dict::Add('HU HU', 'Hungarian', 'Magyar', [
'theme:darkmoon' => 'Dark moon',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('IT IT', 'Italian', 'Italiano', array(
Dict::Add('IT IT', 'Italian', 'Italiano', [
'theme:darkmoon' => 'Luna scura',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('JA JP', 'Japanese', '日本語', array(
Dict::Add('JA JP', 'Japanese', '日本語', [
'theme:darkmoon' => 'Dark moon~~',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
Dict::Add('NL NL', 'Dutch', 'Nederlands', [
'theme:darkmoon' => 'Dark moon',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PL PL', 'Polish', 'Polski', array(
Dict::Add('PL PL', 'Polish', 'Polski', [
'theme:darkmoon' => 'Ciemny Księżyc',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
'theme:darkmoon' => 'Dark moon',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('RU RU', 'Russian', 'Русский', array(
Dict::Add('RU RU', 'Russian', 'Русский', [
'theme:darkmoon' => 'Dark moon~~',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
'theme:darkmoon' => 'Dark moon~~',
));
]);

View File

@@ -1,14 +1,15 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license https://opensource.org/licenses/AGPL-3.0
*
*
*/
/**
*
*/
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
Dict::Add('TR TR', 'Turkish', 'Türkçe', [
'theme:darkmoon' => 'Dark moon~~',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -20,6 +21,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
Dict::Add('ZH CN', 'Chinese', '简体中文', [
'theme:darkmoon' => '暗月',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
//
// iTop module definition file
//
@@ -6,7 +7,7 @@
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'combodo-backoffice-darkmoon-theme/3.2.1',
array(
[
// Identification
//
'label' => 'Backoffice: Darkmoon theme',
@@ -14,38 +15,35 @@ SetupWebPage::AddModule(
// Setup
//
'dependencies' => array(
),
'dependencies' => [
],
'mandatory' => true,
'visible' => false,
// Components
//
'datamodel' => array(
),
'webservice' => array(
),
'data.struct' => array(
'datamodel' => [
],
'webservice' => [
],
'data.struct' => [
// add your 'structure' definition XML files here,
),
'data.sample' => array(
],
'data.sample' => [
// add your sample data XML files here,
),
],
// Documentation
//
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
'doc.more_information' => '', // hyperlink to more information, if any
'doc.more_information' => '', // hyperlink to more information, if any
// Default settings
//
'settings' => array(
'settings' => [
// Module specific settings go here, if any
),
)
],
]
);
?>

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -20,6 +21,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
Dict::Add('CS CZ', 'Czech', 'Čeština', [
'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -21,6 +22,6 @@
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('DA DA', 'Danish', 'Dansk', array(
Dict::Add('DA DA', 'Danish', 'Dansk', [
'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -21,6 +22,6 @@
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('DE DE', 'German', 'Deutsch', array(
Dict::Add('DE DE', 'German', 'Deutsch', [
'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)~~',
));
]);

View File

@@ -1,4 +1,5 @@
<?php
/**
* Localized data
*
@@ -21,6 +22,6 @@
* along with iTop. If not, see <http://www.gnu.org/licenses/>
*/
Dict::Add('EN US', 'English', 'English', array(
Dict::Add('EN US', 'English', 'English', [
'theme:fullmoon-high-contrast' => 'Fullmoon (High contrast)',
));
]);

Some files were not shown because too many files have changed in this diff Show More