Merge pull request #9044 from owncloud/add-missing-email-principal

adding missing email address for principal
This commit is contained in:
Vincent Petry 2014-10-31 13:24:42 +01:00
commit fd4b97d758

View file

@ -26,11 +26,17 @@ class OC_Connector_Sabre_Principal implements \Sabre\DAVACL\PrincipalBackend\Bac
if ($prefixPath == 'principals') { if ($prefixPath == 'principals') {
foreach(OC_User::getUsers() as $user) { foreach(OC_User::getUsers() as $user) {
$user_uri = 'principals/'.$user; $user_uri = 'principals/'.$user;
$principals[] = array( $principals[] = array(
'uri' => $user_uri, 'uri' => $user_uri,
'{DAV:}displayname' => $user, '{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); list($prefix, $name) = explode('/', $path);
if ($prefix == 'principals' && OC_User::userExists($name)) { if ($prefix == 'principals' && OC_User::userExists($name)) {
return array( return array(
'uri' => 'principals/'.$name, 'uri' => 'principals/'.$name,
'{DAV:}displayname' => $name, '{DAV:}displayname' => $name,
); );
$email= \OCP\Config::getUserValue($user, 'settings', 'email');
if($email) {
$principals['{http://sabredav.org/ns}email-address'] = $email;
}
} }
return null; return null;