From eaa09a2799b36b2ba3119c309b15a803ab1a7fc8 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 13 May 2017 11:07:54 +0200 Subject: [PATCH] new type API --- lam/lib/modules/posixAccount.inc | 3 +++ lam/lib/types.inc | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 41a57607..d17afba9 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -529,6 +529,9 @@ class posixAccount extends baseModule implements passwordService { public function getManagedAttributes($typeId) { $attrs = parent::getManagedAttributes($typeId); $typeManager = new TypeManager(); + if (!$typeManager->hasConfig()) { + return $attrs; + } $modules = $typeManager->getConfiguredType($typeId)->getModules(); if ($this->manageCn($modules)) { $attrs[] = 'cn'; diff --git a/lam/lib/types.inc b/lam/lib/types.inc index 4d85e600..acf068bc 100644 --- a/lam/lib/types.inc +++ b/lam/lib/types.inc @@ -393,7 +393,9 @@ class TypeManager { * @return \LAM\TYPES\ConfiguredType|NULL type */ public function getConfiguredType($typeId) { - $configuredTypes = array(); + if ($this->config == null) { + return null; + } $activeTypes = $this->config->get_ActiveTypes(); if (in_array($typeId, $activeTypes)) { return $this->buildConfiguredType($typeId); @@ -485,6 +487,15 @@ class TypeManager { return $this->config; } + /** + * Returns if configuration is loaded. + * + * @return boolean configured + */ + public function hasConfig() { + return !empty($this->config); + } + } ?> \ No newline at end of file