mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 17:48:43 +02:00
Finalization of the user management by profile (UI to manage the accounts), and some unrelated changes:
- Using class labels in the UI - Data model: you may specify a set of allowed values from a query (see caller_id in bizIncident class), still not 100% used in the UI but does not generate any error - Data model: you may specify a password field (AttributePassword replacing AttributeString) - Setup: calling UserRight::Setup() right after calling UserRight::CreateAdministrator() - Setup: administrator account created with "my organization" and a dedicated contact - Menus: optimized the load of std menus (queries written in OQL to get the benefit of the query cache) - Menus: admin tools, seen only by people having the "admin" profile - Object edition: fixed bug with the display of N-N links in the form SVN:trunk[110]
This commit is contained in:
@@ -178,6 +178,13 @@ abstract class AttributeDefinition
|
||||
{
|
||||
return str_replace($sSeparator, $sSepEscape, $sValue);
|
||||
}
|
||||
|
||||
public function GetAllowedValues($aArgs = array(), $sBeginsWith = '')
|
||||
{
|
||||
$oValSetDef = $this->GetValuesDef();
|
||||
if (!$oValSetDef) return null;
|
||||
return $oValSetDef->GetValues($aArgs, $sBeginsWith);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,7 +497,10 @@ class AttributeString extends AttributeDBField
|
||||
}
|
||||
public function RealValueToSQLValue($value)
|
||||
{
|
||||
assert(is_string($value));
|
||||
if (!is_string($value))
|
||||
{
|
||||
throw new CoreWarning('Expected the attribute value to be a string', array('found_type' => gettype($value), 'value' => $value, 'class' => $this->GetCode(), 'attribute' => $this->GetHostClass()));
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
public function SQLValueToRealValue($value)
|
||||
@@ -499,6 +509,29 @@ class AttributeString extends AttributeDBField
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Map a varchar column (size < ?) to an attribute that must never be shown to the user
|
||||
*
|
||||
* @package iTopORM
|
||||
* @author Romain Quetiez <romainquetiez@yahoo.fr>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.itop.com
|
||||
* @since 1.0
|
||||
* @version $itopversion$
|
||||
*/
|
||||
class AttributePassword extends AttributeString
|
||||
{
|
||||
static protected function ListExpectedParams()
|
||||
{
|
||||
return parent::ListExpectedParams();
|
||||
//return array_merge(parent::ListExpectedParams(), array());
|
||||
}
|
||||
|
||||
public function GetEditClass() {return "Password";}
|
||||
public function GetDBFieldType() {return "VARCHAR(64)";}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a text column (size > ?) to an attribute
|
||||
*
|
||||
@@ -778,7 +811,7 @@ class AttributeExternalKey extends AttributeDBFieldVoid
|
||||
}
|
||||
|
||||
// overloaded here so that an ext key always have the answer to
|
||||
// "what are you possible values?"
|
||||
// "what are your possible values?"
|
||||
public function GetValuesDef()
|
||||
{
|
||||
$oValSetDef = $this->Get("allowed_values");
|
||||
@@ -788,7 +821,21 @@ class AttributeExternalKey extends AttributeDBFieldVoid
|
||||
$oValSetDef = new ValueSetObjects($this->GetTargetClass());
|
||||
}
|
||||
return $oValSetDef;
|
||||
}
|
||||
}
|
||||
|
||||
public function GetAllowedValues($aArgs = array(), $sBeginsWith = '')
|
||||
{
|
||||
try
|
||||
{
|
||||
return parent::GetAllowedValues($aArgs, $sBeginsWith);
|
||||
}
|
||||
catch (MissingQueryArgument $e)
|
||||
{
|
||||
// Some required arguments could not be found, enlarge to any existing value
|
||||
$oValSetDef = new ValueSetObjects($this->GetTargetClass());
|
||||
return $oValSetDef->GetValues($aArgs, $sBeginsWith);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user