Do not sync user role if LDAP groups are not configured

This commit is contained in:
Frederic Guillot
2016-05-30 21:47:31 -04:00
parent 679a22c718
commit 4987e245bb
5 changed files with 51 additions and 2 deletions

View File

@@ -108,12 +108,18 @@ class User
/**
* Get role from LDAP groups
*
* Note: Do not touch the current role if groups are not configured
*
* @access protected
* @param string[] $groupIds
* @return string
*/
protected function getRole(array $groupIds)
{
if ($this->hasGroupsNotConfigured()) {
return null;
}
foreach ($groupIds as $groupId) {
$groupId = strtolower($groupId);
@@ -271,6 +277,17 @@ class User
return $this->getGroupUserFilter() !== '' && $this->getGroupUserFilter() !== null;
}
/**
* Return true if LDAP Group mapping is not configured
*
* @access public
* @return boolean
*/
public function hasGroupsNotConfigured()
{
return !$this->getGroupAdminDn() && !$this->getGroupManagerDn();
}
/**
* Get LDAP admin group DN
*