diff options
Diffstat (limited to 'apps/user_ldap/lib/access.php')
-rw-r--r-- | apps/user_ldap/lib/access.php | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 692afb98f99..3e9869b4d71 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -76,6 +76,18 @@ class Access extends LDAPUtility implements user\IUserTools { } /** + * returns the User Mapper + * @throws \Exception + * @return AbstractMapping + */ + public function getUserMapper() { + if(is_null($this->userMapper)) { + throw new \Exception('UserMapper was not assigned to this Access instance.'); + } + return $this->userMapper; + } + + /** * sets the Group Mapper * @param AbstractMapping $mapper */ @@ -84,6 +96,18 @@ class Access extends LDAPUtility implements user\IUserTools { } /** + * returns the Group Mapper + * @throws \Exception + * @return AbstractMapping + */ + public function getGroupMapper() { + if(is_null($this->groupMapper)) { + throw new \Exception('GroupMapper was not assigned to this Access instance.'); + } + return $this->groupMapper; + } + + /** * @return bool */ private function checkConnection() { @@ -333,10 +357,10 @@ class Access extends LDAPUtility implements user\IUserTools { */ public function dn2ocname($fdn, $ldapName = null, $isUser = true) { if($isUser) { - $mapper = $this->userMapper; + $mapper = $this->getUserMapper(); $nameAttribute = $this->connection->ldapUserDisplayName; } else { - $mapper = $this->groupMapper; + $mapper = $this->getGroupMapper(); $nameAttribute = $this->connection->ldapGroupDisplayName; } |