]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/CalDAV/Principal/ProxyWrite.php
removed community home addon
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / CalDAV / Principal / ProxyWrite.php
1 <?php
2
3 /**
4  * ProxyWrite principal
5  *
6  * This class represents a principal group, hosted under the main principal.
7  * This is needed to implement 'Calendar delegation' support. This class is
8  * instantiated by Sabre_CalDAV_Principal_User.
9  *
10  * @package Sabre
11  * @subpackage CalDAV
12  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
13  * @author Evert Pot (http://www.rooftopsolutions.nl/) 
14  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
15  */
16 class Sabre_CalDAV_Principal_ProxyWrite implements Sabre_DAVACL_IPrincipal {
17
18     /**
19      * Parent principal information
20      *
21      * @var array
22      */
23     protected $principalInfo;
24
25     /**
26      * Principal Backend
27      *
28      * @var Sabre_DAVACL_IPrincipalBackend
29      */
30     protected $principalBackend;
31
32     /**
33      * Creates the object
34      *
35      * Note that you MUST supply the parent principal information.
36      *
37      * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
38      * @param array $principalInfo
39      */
40     public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, array $principalInfo) {
41
42         $this->principalInfo = $principalInfo;
43         $this->principalBackend = $principalBackend;
44
45     }
46
47     /**
48      * Returns this principals name.
49      *
50      * @return string
51      */
52     public function getName() {
53
54         return 'calendar-proxy-write';
55
56     }
57
58     /**
59      * Returns the last modification time
60      *
61      * @return null
62      */
63     public function getLastModified() {
64
65         return null;
66
67     }
68
69     /**
70      * Deletes the current node
71      *
72      * @throws Sabre_DAV_Exception_Forbidden
73      * @return void
74      */
75     public function delete() {
76
77         throw new Sabre_DAV_Exception_Forbidden('Permission denied to delete node');
78
79     }
80
81     /**
82      * Renames the node
83      *
84      * @throws Sabre_DAV_Exception_Forbidden
85      * @param string $name The new name
86      * @return void
87      */
88     public function setName($name) {
89
90         throw new Sabre_DAV_Exception_Forbidden('Permission denied to rename file');
91
92     }
93
94
95     /**
96      * Returns a list of alternative urls for a principal
97      *
98      * This can for example be an email address, or ldap url.
99      *
100      * @return array
101      */
102     public function getAlternateUriSet() {
103
104         return array();
105
106     }
107
108     /**
109      * Returns the full principal url
110      *
111      * @return string
112      */
113     public function getPrincipalUrl() {
114
115         return $this->principalInfo['uri'] . '/' . $this->getName();
116
117     }
118
119     /**
120      * Returns the list of group members
121      *
122      * If this principal is a group, this function should return
123      * all member principal uri's for the group.
124      *
125      * @return array
126      */
127     public function getGroupMemberSet() {
128
129         return $this->principalBackend->getGroupMemberSet($this->getPrincipalUrl());
130
131     }
132
133     /**
134      * Returns the list of groups this principal is member of
135      *
136      * If this principal is a member of a (list of) groups, this function
137      * should return a list of principal uri's for it's members.
138      *
139      * @return array
140      */
141     public function getGroupMembership() {
142
143         return $this->principalBackend->getGroupMembership($this->getPrincipalUrl());
144
145     }
146
147     /**
148      * Sets a list of group members
149      *
150      * If this principal is a group, this method sets all the group members.
151      * The list of members is always overwritten, never appended to.
152      *
153      * This method should throw an exception if the members could not be set.
154      *
155      * @param array $principals
156      * @return void
157      */
158     public function setGroupMemberSet(array $principals) {
159
160         $this->principalBackend->setGroupMemberSet($this->getPrincipalUrl(), $principals);
161
162     }
163
164     /**
165      * Returns the displayname
166      *
167      * This should be a human readable name for the principal.
168      * If none is available, return the nodename.
169      *
170      * @return string
171      */
172     public function getDisplayName() {
173
174         return $this->getName();
175
176     }
177
178 }