summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/user_proxy.php
diff options
context:
space:
mode:
authorraghunayyar <me@iraghu.com>2014-01-16 14:42:37 +0530
committerraghunayyar <me@iraghu.com>2014-01-16 14:42:37 +0530
commit775e08e0ee4125cc7b2a594771437686f6a21b56 (patch)
tree362f84449171898335dd3e8511b65c97c150e9e1 /apps/user_ldap/user_proxy.php
parent4687d2dd0bde3f689eb57c90d0c4341cd00991bd (diff)
parentbd643c47f32ba6d7b3ba6a18ed1591aab0b81be8 (diff)
downloadnextcloud-server-775e08e0ee4125cc7b2a594771437686f6a21b56.tar.gz
nextcloud-server-775e08e0ee4125cc7b2a594771437686f6a21b56.zip
Merge branch 'master' into core-em-to-px
Conflicts: apps/files_sharing/css/public.css apps/user_ldap/css/settings.css core/css/multiselect.css core/css/share.css
Diffstat (limited to 'apps/user_ldap/user_proxy.php')
-rw-r--r--apps/user_ldap/user_proxy.php30
1 files changed, 28 insertions, 2 deletions
diff --git a/apps/user_ldap/user_proxy.php b/apps/user_ldap/user_proxy.php
index 092fdbf7c78..5ad127197f3 100644
--- a/apps/user_ldap/user_proxy.php
+++ b/apps/user_ldap/user_proxy.php
@@ -54,6 +54,7 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
protected function walkBackends($uid, $method, $parameters) {
$cacheKey = $this->getUserCacheKey($uid);
foreach($this->backends as $configPrefix => $backend) {
+// print("walkBackend '$configPrefix'<br/>");
if($result = call_user_func_array(array($backend, $method), $parameters)) {
$this->writeToCache($cacheKey, $configPrefix);
return $result;
@@ -67,16 +68,17 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
* @param $uid string, the uid connected to the request
* @param $method string, the method of the user backend that shall be called
* @param $parameters an array of parameters to be passed
+ * @param $passOnWhen the result matches this variable
* @return mixed, the result of the method or false
*/
- protected function callOnLastSeenOn($uid, $method, $parameters) {
+ protected function callOnLastSeenOn($uid, $method, $parameters, $passOnWhen) {
$cacheKey = $this->getUserCacheKey($uid);
$prefix = $this->getFromCache($cacheKey);
//in case the uid has been found in the past, try this stored connection first
if(!is_null($prefix)) {
if(isset($this->backends[$prefix])) {
$result = call_user_func_array(array($this->backends[$prefix], $method), $parameters);
- if(!$result) {
+ if($result === $passOnWhen) {
//not found here, reset cache to null if user vanished
//because sometimes methods return false with a reason
$userExists = call_user_func_array(
@@ -164,6 +166,15 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
}
/**
+ * @brief checks whether the user is allowed to change his avatar in ownCloud
+ * @param $uid string the ownCloud user name
+ * @return boolean either the user can or cannot
+ */
+ public function canChangeAvatar($uid) {
+ return $this->handleRequest($uid, 'canChangeAvatar', array($uid), true);
+ }
+
+ /**
* @brief Get a list of all display names
* @returns array with all displayNames (value) and the corresponding uids (key)
*
@@ -199,4 +210,19 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
return $this->refBackend->hasUserListings();
}
+ /**
+ * @brief Count the number of users
+ * @returns int | bool
+ */
+ public function countUsers() {
+ $users = false;
+ foreach($this->backends as $backend) {
+ $backendUsers = $backend->countUsers();
+ if ($backendUsers !== false) {
+ $users += $backendUsers;
+ }
+ }
+ return $users;
+ }
+
}