mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 08:38:45 +02:00
Merge branch 'split-file_attributedef.class.inc.php_AttributePassword.php' into split-file_attributedef.class.inc.php
This commit is contained in:
65
core/attributedef/AttributePassword.php
Normal file
65
core/attributedef/AttributePassword.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Map a varchar column (size < ?) to an attribute that must never be shown to the user
|
||||
*
|
||||
* @package iTopORM
|
||||
*/
|
||||
class AttributePassword extends AttributeString implements iAttributeNoGroupBy
|
||||
{
|
||||
const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW;
|
||||
|
||||
/**
|
||||
* Useless constructor, but if not present PHP 7.4.0/7.4.1 is crashing :( (N°2329)
|
||||
*
|
||||
* @see https://www.php.net/manual/fr/language.oop5.decon.php states that child constructor can be ommited
|
||||
* @see https://bugs.php.net/bug.php?id=79010 bug solved in PHP 7.4.9
|
||||
*
|
||||
* @param string $sCode
|
||||
* @param array $aParams
|
||||
*
|
||||
* @throws \Exception
|
||||
* @noinspection SenselessProxyMethodInspection
|
||||
*/
|
||||
public function __construct($sCode, $aParams)
|
||||
{
|
||||
parent::__construct($sCode, $aParams);
|
||||
}
|
||||
|
||||
public static function ListExpectedParams()
|
||||
{
|
||||
return parent::ListExpectedParams();
|
||||
//return array_merge(parent::ListExpectedParams(), array());
|
||||
}
|
||||
|
||||
public function GetEditClass()
|
||||
{
|
||||
return "Password";
|
||||
}
|
||||
|
||||
protected function GetSQLCol($bFullSpec = false)
|
||||
{
|
||||
return "VARCHAR(64)"
|
||||
. CMDBSource::GetSqlStringColumnDefinition()
|
||||
. ($bFullSpec ? $this->GetSQLColSpec() : '');
|
||||
}
|
||||
|
||||
public function GetMaxSize()
|
||||
{
|
||||
return 64;
|
||||
}
|
||||
|
||||
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
|
||||
{
|
||||
if (utils::IsNullOrEmptyString($sValue)) {
|
||||
return '';
|
||||
} else {
|
||||
return '******';
|
||||
}
|
||||
}
|
||||
|
||||
public function IsPartOfFingerprint()
|
||||
{
|
||||
return false;
|
||||
} // Cannot reliably compare two encrypted passwords since the same password will be encrypted in diffferent manners depending on the random 'salt'
|
||||
}
|
||||
Reference in New Issue
Block a user