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.
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
16 class Sabre_CalDAV_Principal_ProxyRead implements Sabre_DAVACL_IPrincipal {
19 * Principal information from the parent principal.
23 protected $principalInfo;
28 * @var Sabre_DAVACL_IPrincipalBackend
30 protected $principalBackend;
35 * Note that you MUST supply the parent principal information.
37 * @param Sabre_DAVACL_IPrincipalBackend $principalBackend
38 * @param array $principalInfo
40 public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, array $principalInfo) {
42 $this->principalInfo = $principalInfo;
43 $this->principalBackend = $principalBackend;
48 * Returns this principals name.
52 public function getName() {
54 return 'calendar-proxy-read';
59 * Returns the last modification time
63 public function getLastModified() {
70 * Deletes the current node
72 * @throws Sabre_DAV_Exception_Forbidden
75 public function delete() {
77 throw new Sabre_DAV_Exception_Forbidden('Permission denied to delete node');
84 * @throws Sabre_DAV_Exception_Forbidden
85 * @param string $name The new name
88 public function setName($name) {
90 throw new Sabre_DAV_Exception_Forbidden('Permission denied to rename file');
96 * Returns a list of alternative urls for a principal
98 * This can for example be an email address, or ldap url.
102 public function getAlternateUriSet() {
109 * Returns the full principal url
113 public function getPrincipalUrl() {
115 return $this->principalInfo['uri'] . '/' . $this->getName();
120 * Returns the list of group members
122 * If this principal is a group, this function should return
123 * all member principal uri's for the group.
127 public function getGroupMemberSet() {
129 return $this->principalBackend->getGroupMemberSet($this->getPrincipalUrl());
134 * Returns the list of groups this principal is member of
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.
141 public function getGroupMembership() {
143 return $this->principalBackend->getGroupMembership($this->getPrincipalUrl());
148 * Sets a list of group members
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.
153 * This method should throw an exception if the members could not be set.
155 * @param array $principals
158 public function setGroupMemberSet(array $principals) {
160 $this->principalBackend->setGroupMemberSet($this->getPrincipalUrl(), $principals);
165 * Returns the displayname
167 * This should be a human readable name for the principal.
168 * If none is available, return the nodename.
172 public function getDisplayName() {
174 return $this->getName();