summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/proxy.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib/proxy.php')
-rw-r--r--apps/user_ldap/lib/proxy.php47
1 files changed, 38 insertions, 9 deletions
diff --git a/apps/user_ldap/lib/proxy.php b/apps/user_ldap/lib/proxy.php
index 0eb294eb7a0..2d5210791c5 100644
--- a/apps/user_ldap/lib/proxy.php
+++ b/apps/user_ldap/lib/proxy.php
@@ -29,16 +29,26 @@ abstract class Proxy {
static private $accesses = array();
private $ldap = null;
+ /**
+ * @param ILDAPWrapper $ldap
+ */
public function __construct(ILDAPWrapper $ldap) {
$this->ldap = $ldap;
$this->cache = \OC_Cache::getGlobalCache();
}
+ /**
+ * @param $configPrefix
+ */
private function addAccess($configPrefix) {
$connector = new Connection($this->ldap, $configPrefix);
self::$accesses[$configPrefix] = new Access($connector, $this->ldap);
}
+ /**
+ * @param $configPrefix
+ * @return mixed
+ */
protected function getAccess($configPrefix) {
if(!isset(self::$accesses[$configPrefix])) {
$this->addAccess($configPrefix);
@@ -46,30 +56,45 @@ abstract class Proxy {
return self::$accesses[$configPrefix];
}
+ /**
+ * @param $uid
+ * @return string
+ */
protected function getUserCacheKey($uid) {
return 'user-'.$uid.'-lastSeenOn';
}
+ /**
+ * @param $gid
+ * @return string
+ */
protected function getGroupCacheKey($gid) {
return 'group-'.$gid.'-lastSeenOn';
}
/**
- * @param boolean $passOnWhen
- * @param string $method
+ * @param $id
+ * @param $method
+ * @param $parameters
+ * @param bool $passOnWhen
+ * @return mixed
*/
abstract protected function callOnLastSeenOn($id, $method, $parameters, $passOnWhen);
/**
- * @param string $method
+ * @param $id
+ * @param $method
+ * @param $parameters
+ * @return mixed
*/
abstract protected function walkBackends($id, $method, $parameters);
/**
* @brief Takes care of the request to the User backend
- * @param $uid string, the uid connected to the request
+ * @param $id
* @param string $method string, the method of the user backend that shall be called
- * @param $parameters an array of parameters to be passed
+ * @param array $parameters an array of parameters to be passed
+ * @param bool $passOnWhen
* @return mixed, the result of the specified method
*/
protected function handleRequest($id, $method, $parameters, $passOnWhen = false) {
@@ -81,7 +106,8 @@ abstract class Proxy {
}
/**
- * @param string|null $key
+ * @param $key
+ * @return string
*/
private function getCacheKey($key) {
$prefix = 'LDAP-Proxy-';
@@ -92,7 +118,8 @@ abstract class Proxy {
}
/**
- * @param string $key
+ * @param $key
+ * @return mixed|null
*/
public function getFromCache($key) {
if(!$this->isCached($key)) {
@@ -104,7 +131,8 @@ abstract class Proxy {
}
/**
- * @param string $key
+ * @param $key
+ * @return bool
*/
public function isCached($key) {
$key = $this->getCacheKey($key);
@@ -112,7 +140,8 @@ abstract class Proxy {
}
/**
- * @param string $key
+ * @param $key
+ * @param $value
*/
public function writeToCache($key, $value) {
$key = $this->getCacheKey($key);