|
|
|
@ -107,8 +107,8 @@ class Access extends LDAPUtility { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @brief checks wether the given attribute`s valua is probably a DN |
|
|
|
|
* @param $attr the attribute in question |
|
|
|
|
* @return if so true, otherwise false |
|
|
|
|
* @param string $attr the attribute in question |
|
|
|
|
* @return boolean if so true, otherwise false |
|
|
|
|
*/ |
|
|
|
|
private function resemblesDN($attr) { |
|
|
|
|
$resemblingAttributes = array( |
|
|
|
@ -175,7 +175,7 @@ class Access extends LDAPUtility { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @brief returns the LDAP DN for the given internal ownCloud name of the group |
|
|
|
|
* @param $name the ownCloud name in question |
|
|
|
|
* @param string $name the ownCloud name in question |
|
|
|
|
* @returns string with the LDAP DN on success, otherwise false |
|
|
|
|
* |
|
|
|
|
* returns the LDAP DN for the given internal ownCloud name of the group |
|
|
|
@ -211,7 +211,7 @@ class Access extends LDAPUtility { |
|
|
|
|
/** |
|
|
|
|
* @brief returns the LDAP DN for the given internal ownCloud name |
|
|
|
|
* @param $name the ownCloud name in question |
|
|
|
|
* @param $isUser is it a user? otherwise group |
|
|
|
|
* @param boolean $isUser is it a user? otherwise group |
|
|
|
|
* @returns string with the LDAP DN on success, otherwise false |
|
|
|
|
* |
|
|
|
|
* returns the LDAP DN for the given internal ownCloud name |
|
|
|
@ -417,6 +417,9 @@ class Access extends LDAPUtility { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param boolean $isUsers |
|
|
|
|
*/ |
|
|
|
|
private function ldap2ownCloudNames($ldapObjects, $isUsers) { |
|
|
|
|
if($isUsers) { |
|
|
|
|
$nameAttribute = $this->connection->ldapUserDisplayName; |
|
|
|
@ -509,7 +512,7 @@ class Access extends LDAPUtility { |
|
|
|
|
/** |
|
|
|
|
* @brief creates a unique name for internal ownCloud use. |
|
|
|
|
* @param $name the display name of the object |
|
|
|
|
* @param $isUser boolean, whether name should be created for a user (true) or a group (false) |
|
|
|
|
* @param boolean $isUser whether name should be created for a user (true) or a group (false) |
|
|
|
|
* @returns string with with the name to use in ownCloud or false if unsuccessful |
|
|
|
|
*/ |
|
|
|
|
private function createAltInternalOwnCloudName($name, $isUser) { |
|
|
|
@ -545,6 +548,9 @@ class Access extends LDAPUtility { |
|
|
|
|
return $this->mappedComponents(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param boolean $isUsers |
|
|
|
|
*/ |
|
|
|
|
private function mappedComponents($isUsers) { |
|
|
|
|
$table = $this->getMapTable($isUsers); |
|
|
|
|
|
|
|
|
@ -601,14 +607,26 @@ class Access extends LDAPUtility { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param integer $limit |
|
|
|
|
* @param integer $offset |
|
|
|
|
*/ |
|
|
|
|
public function fetchListOfUsers($filter, $attr, $limit = null, $offset = null) { |
|
|
|
|
return $this->fetchList($this->searchUsers($filter, $attr, $limit, $offset), (count($attr) > 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param string $filter |
|
|
|
|
* @param integer $limit |
|
|
|
|
* @param integer $offset |
|
|
|
|
*/ |
|
|
|
|
public function fetchListOfGroups($filter, $attr, $limit = null, $offset = null) { |
|
|
|
|
return $this->fetchList($this->searchGroups($filter, $attr, $limit, $offset), (count($attr) > 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param boolean $manyAttributes |
|
|
|
|
*/ |
|
|
|
|
private function fetchList($list, $manyAttributes) { |
|
|
|
|
if(is_array($list)) { |
|
|
|
|
if($manyAttributes) { |
|
|
|
@ -634,6 +652,9 @@ class Access extends LDAPUtility { |
|
|
|
|
return $this->search($filter, $this->connection->ldapBaseUsers, $attr, $limit, $offset); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param string $filter |
|
|
|
|
*/ |
|
|
|
|
public function countUsers($filter, $attr = array('dn'), $limit = null, $offset = null) { |
|
|
|
|
return $this->count($filter, $this->connection->ldapBaseGroups, $attr, $limit, $offset); |
|
|
|
|
} |
|
|
|
@ -702,7 +723,7 @@ class Access extends LDAPUtility { |
|
|
|
|
* @param $limit maximum results to be counted |
|
|
|
|
* @param $offset a starting point |
|
|
|
|
* @param $pagedSearchOK whether a paged search has been executed |
|
|
|
|
* @param $skipHandling required for paged search when cookies to |
|
|
|
|
* @param boolean $skipHandling required for paged search when cookies to |
|
|
|
|
* prior results need to be gained |
|
|
|
|
* @returns array with the search result as first value and pagedSearchOK as |
|
|
|
|
* second | false if not successful |
|
|
|
@ -920,7 +941,7 @@ class Access extends LDAPUtility { |
|
|
|
|
/** |
|
|
|
|
* @brief combines the input filters with given operator |
|
|
|
|
* @param $filters array, the filters to connect |
|
|
|
|
* @param $operator either & or | |
|
|
|
|
* @param string $operator either & or | |
|
|
|
|
* @returns the combined filter |
|
|
|
|
* |
|
|
|
|
* Combines Filter arguments with AND |
|
|
|
@ -1173,7 +1194,7 @@ class Access extends LDAPUtility { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @brief check wether the most recent paged search was successful. It flushed the state var. Use it always after a possible paged search. |
|
|
|
|
* @return true on success, null or false otherwise |
|
|
|
|
* @return boolean|null true on success, null or false otherwise |
|
|
|
|
*/ |
|
|
|
|
public function getPagedSearchResultState() { |
|
|
|
|
$result = $this->pagedSearchedSuccessful; |
|
|
|
|