]> source.dussan.org Git - nextcloud-server.git/commitdiff
adding missing email address for principal
authorlibasys <sebastian.doell@libasys.de>
Tue, 27 May 2014 08:38:56 +0000 (10:38 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Fri, 24 Oct 2014 09:12:23 +0000 (11:12 +0200)
* fix #8515
* add mail only if it exists

lib/private/connector/sabre/principal.php

index 9bad3b9df16ef1dac2e055fd364172ef3e851d6d..c674e2aa779df692d7d7f21b2e3f4d17cecbec29 100644 (file)
@@ -26,11 +26,17 @@ class OC_Connector_Sabre_Principal implements \Sabre\DAVACL\PrincipalBackend\Bac
 
                if ($prefixPath == 'principals') {
                        foreach(OC_User::getUsers() as $user) {
+
                                $user_uri = 'principals/'.$user;
                                $principals[] = array(
                                        'uri' => $user_uri,
                                        '{DAV:}displayname' => $user,
                                );
+
+                               $email= \OCP\Config::getUserValue($user, 'settings', 'email');
+                               if($email) {
+                                       $principals['{http://sabredav.org/ns}email-address'] = $email;
+                               }
                        }
                }
 
@@ -49,10 +55,16 @@ class OC_Connector_Sabre_Principal implements \Sabre\DAVACL\PrincipalBackend\Bac
                list($prefix, $name) = explode('/', $path);
 
                if ($prefix == 'principals' && OC_User::userExists($name)) {
+
                        return array(
                                'uri' => 'principals/'.$name,
                                '{DAV:}displayname' => $name,
                        );
+
+                       $email= \OCP\Config::getUserValue($user, 'settings', 'email');
+                       if($email) {
+                               $principals['{http://sabredav.org/ns}email-address'] = $email;
+                       }
                }
 
                return null;