new type API

This commit is contained in:
Roland Gruber 2017-05-13 11:07:54 +02:00
parent 5d10297448
commit eaa09a2799
2 changed files with 15 additions and 1 deletions

View File

@ -529,6 +529,9 @@ class posixAccount extends baseModule implements passwordService {
public function getManagedAttributes($typeId) { public function getManagedAttributes($typeId) {
$attrs = parent::getManagedAttributes($typeId); $attrs = parent::getManagedAttributes($typeId);
$typeManager = new TypeManager(); $typeManager = new TypeManager();
if (!$typeManager->hasConfig()) {
return $attrs;
}
$modules = $typeManager->getConfiguredType($typeId)->getModules(); $modules = $typeManager->getConfiguredType($typeId)->getModules();
if ($this->manageCn($modules)) { if ($this->manageCn($modules)) {
$attrs[] = 'cn'; $attrs[] = 'cn';

View File

@ -393,7 +393,9 @@ class TypeManager {
* @return \LAM\TYPES\ConfiguredType|NULL type * @return \LAM\TYPES\ConfiguredType|NULL type
*/ */
public function getConfiguredType($typeId) { public function getConfiguredType($typeId) {
$configuredTypes = array(); if ($this->config == null) {
return null;
}
$activeTypes = $this->config->get_ActiveTypes(); $activeTypes = $this->config->get_ActiveTypes();
if (in_array($typeId, $activeTypes)) { if (in_array($typeId, $activeTypes)) {
return $this->buildConfiguredType($typeId); return $this->buildConfiguredType($typeId);
@ -485,6 +487,15 @@ class TypeManager {
return $this->config; return $this->config;
} }
/**
* Returns if configuration is loaded.
*
* @return boolean configured
*/
public function hasConfig() {
return !empty($this->config);
}
} }
?> ?>