Blame view

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