]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/tests/Sabre/DAV/Auth/MockBackend.php
Merge branch 'master' of git://github.com/friendica/friendica-addons
[friendica-addons.git] / dav / SabreDAV / tests / Sabre / DAV / Auth / MockBackend.php
1 <?php
2
3 class Sabre_DAV_Auth_MockBackend implements Sabre_DAV_Auth_IBackend {
4
5     protected $currentUser;
6
7     /**
8      * @param Sabre_DAV_Server $server
9      * @param string $realm
10      * @throws Sabre_DAV_Exception_NotAuthenticated
11      */
12     function authenticate(Sabre_DAV_Server $server, $realm) {
13
14         if ($realm=='failme') throw new Sabre_DAV_Exception_NotAuthenticated('deliberate fail');
15
16         $this->currentUser = 'admin';
17
18     }
19
20     function setCurrentUser($user) {
21
22         $this->currentUser = $user;
23
24     }
25
26     function getCurrentUser() {
27
28         return $this->currentUser;
29
30     }
31
32 }