xref: /plugin/davcal/principalBackendDokuwiki.php (revision a495d34c25233615fa25fba79abef99239c1dd50)
1<?php
2
3class DokuWikiSabrePrincipalBackend extends Sabre\DAVACL\PrincipalBackend\AbstractBackend {
4
5    public function getPrincipalsByPrefix($prefixPath)
6    {
7        global $auth;
8        $users = $auth->retrieveUsers();
9        $principals = array();
10        foreach($users as $user => $info)
11        {
12            $principal = 'principals/'.$user;
13            if(strpos($principal, $prefixPath) === 0)
14                $data = $this->getPrincipalByPath($user);
15                if(!empty($data))
16                    $principals[] = $data;
17        }
18        return $principals;
19    }
20
21    public function getPrincipalByPath($path)
22    {
23        global $auth;
24        $user = str_replace('principals/', '', $path);
25        $userData = $auth->getUserData($user);
26        if($userData === false)
27            return array();
28
29        return array('uri' => 'principals/'.$user,
30            'email' => $userData['mail'],
31            'displayname' => $userData['name'],
32            'id' => 0);
33    }
34
35    public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch)
36    {
37
38    }
39
40    public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof')
41    {
42
43    }
44
45
46    public function getGroupMemberSet($principal)
47    {
48        return array();
49    }
50
51    public function getGroupMemberShip($principal)
52    {
53        return array();
54    }
55
56    public function setGroupMemberSet($principal, array $members)
57    {
58        throw new Exception\NotImplemented('Not Implemented');
59    }
60
61}
62