ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SharedNode.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAV\Mock;
4 
7 
8 class SharedNode extends \Sabre\DAV\Node implements ISharedNode {
9 
10  protected $name;
11  protected $access;
12  protected $invites = [];
13 
14  function __construct($name, $access) {
15 
16  $this->name = $name;
17  $this->access = $access;
18 
19  }
20 
21  function getName() {
22 
23  return $this->name;
24 
25  }
26 
35  function getShareAccess() {
36 
37  return $this->access;
38 
39  }
40 
52  function getShareResourceUri() {
53 
54  return 'urn:example:bar';
55 
56  }
57 
66  function updateInvites(array $sharees) {
67 
68  foreach ($sharees as $sharee) {
69 
70  if ($sharee->access === \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS) {
71  // Removal
72  foreach ($this->invites as $k => $invitee) {
73 
74  if ($invitee->href = $sharee->href) {
75  unset($this->invites[$k]);
76  }
77 
78  }
79 
80  } else {
81  foreach ($this->invites as $k => $invitee) {
82 
83  if ($invitee->href = $sharee->href) {
84  if (!$sharee->inviteStatus) {
85  $sharee->inviteStatus = $invitee->inviteStatus;
86  }
87  // Overwriting an existing invitee
88  $this->invites[$k] = $sharee;
89  continue 2;
90  }
91 
92  }
93  if (!$sharee->inviteStatus) {
94  $sharee->inviteStatus = \Sabre\DAV\Sharing\Plugin::INVITE_NORESPONSE;
95  }
96  // Adding a new invitee
97  $this->invites[] = $sharee;
98  }
99 
100  }
101 
102  }
103 
120  function getInvites() {
121 
122  return $this->invites;
123 
124  }
125 }
updateInvites(array $sharees)
Updates the list of sharees.
Definition: SharedNode.php:66
getInvites()
Returns the list of people whom this resource is shared with.
Definition: SharedNode.php:120
getName()
Returns the name of the node.
Definition: SharedNode.php:21
This interface represents a resource that has sharing capabilities, either because it&#39;s possible for ...
Definition: ISharedNode.php:16
Node class.
Definition: Node.php:14
getShareResourceUri()
This function must return a URI that uniquely identifies the shared resource.
Definition: SharedNode.php:52
getShareAccess()
Returns the &#39;access level&#39; for the instance of this shared resource.
Definition: SharedNode.php:35
__construct($name, $access)
Definition: SharedNode.php:14