Use namespace

This commit is contained in:
Lukas Reschke 2014-12-19 16:50:32 +01:00 committed by Morris Jobke
parent 556c9b6f46
commit 0ed00bca43
2 changed files with 23 additions and 5 deletions

View file

@ -9,15 +9,21 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
namespace OC\Connector\Sabre;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\IConfig; use OCP\IConfig;
class OC_Connector_Sabre_Principal implements \Sabre\DAVACL\PrincipalBackend\BackendInterface { class Principal implements \Sabre\DAVACL\PrincipalBackend\BackendInterface {
/** @var IConfig */ /** @var IConfig */
private $config; private $config;
/** @var IUserManager */ /** @var IUserManager */
private $userManager; private $userManager;
/**
* @param IConfig $config
* @param IUserManager $userManager
*/
public function __construct(IConfig $config, public function __construct(IConfig $config,
IUserManager $userManager) { IUserManager $userManager) {
$this->config = $config; $this->config = $config;
@ -45,7 +51,7 @@ class OC_Connector_Sabre_Principal implements \Sabre\DAVACL\PrincipalBackend\Bac
$principal = [ $principal = [
'uri' => 'principals/' . $user->getUID(), 'uri' => 'principals/' . $user->getUID(),
'{DAV:}displayname' => $user->getUID() '{DAV:}displayname' => $user->getUID(),
]; ];
$email = $this->config->getUserValue($user->getUID(), 'settings', 'email'); $email = $this->config->getUserValue($user->getUID(), 'settings', 'email');
@ -149,10 +155,20 @@ class OC_Connector_Sabre_Principal implements \Sabre\DAVACL\PrincipalBackend\Bac
throw new \Sabre\DAV\Exception('Setting members of the group is not supported yet'); throw new \Sabre\DAV\Exception('Setting members of the group is not supported yet');
} }
/**
* @param string $path
* @param array $mutations
* @return int
*/
function updatePrincipal($path, $mutations) { function updatePrincipal($path, $mutations) {
return 0; return 0;
} }
/**
* @param string $prefixPath
* @param array $searchProperties
* @return array
*/
function searchPrincipals($prefixPath, array $searchProperties) { function searchPrincipals($prefixPath, array $searchProperties) {
return []; return [];
} }

View file

@ -8,15 +8,17 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
namespace OC\Connector\Sabre;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\IConfig; use OCP\IConfig;
class Test_OC_Connector_Sabre_Principal extends \Test\TestCase { class Test_Principal extends \Test\TestCase {
/** @var IUserManager */ /** @var IUserManager */
private $userManager; private $userManager;
/** @var IConfig */ /** @var IConfig */
private $config; private $config;
/** @var OC_Connector_Sabre_Principal */ /** @var Principal */
private $connector; private $connector;
public function setUp() { public function setUp() {
@ -25,7 +27,7 @@ class Test_OC_Connector_Sabre_Principal extends \Test\TestCase {
$this->config = $this->getMockBuilder('\OCP\IConfig') $this->config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()->getMock(); ->disableOriginalConstructor()->getMock();
$this->connector = new OC_Connector_Sabre_Principal($this->config, $this->userManager); $this->connector = new Principal($this->config, $this->userManager);
parent::setUp(); parent::setUp();
} }