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