ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\Mock\SharedNode Class Reference
+ Inheritance diagram for Sabre\DAV\Mock\SharedNode:
+ Collaboration diagram for Sabre\DAV\Mock\SharedNode:

Public Member Functions

 __construct ($name, $access)
 
 getName ()
 Returns the name of the node. More...
 
 getShareAccess ()
 Returns the 'access level' for the instance of this shared resource. More...
 
 getShareResourceUri ()
 This function must return a URI that uniquely identifies the shared resource. More...
 
 updateInvites (array $sharees)
 Updates the list of sharees. More...
 
 getInvites ()
 Returns the list of people whom this resource is shared with. More...
 
- Public Member Functions inherited from Sabre\DAV\Node
 getLastModified ()
 Returns the last modification time as a unix timestamp. More...
 
 delete ()
 Deletes the current node. More...
 
 setName ($name)
 Renames the node. More...
 

Protected Attributes

 $name
 
 $access
 
 $invites = []
 

Detailed Description

Definition at line 8 of file SharedNode.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAV\Mock\SharedNode::__construct (   $name,
  $access 
)

Definition at line 14 of file SharedNode.php.

References Sabre\DAV\Mock\SharedNode\$access, and Sabre\DAV\Mock\SharedNode\$name.

14  {
15 
16  $this->name = $name;
17  $this->access = $access;
18 
19  }

Member Function Documentation

◆ getInvites()

Sabre\DAV\Mock\SharedNode::getInvites ( )

Returns the list of people whom this resource is shared with.

Every item in the returned array must be a Sharee object with at least the following properties set:

  • $href
  • $shareAccess
  • $inviteStatus

and optionally:

  • $properties
Returns
[]

Implements Sabre\DAV\Sharing\ISharedNode.

Definition at line 120 of file SharedNode.php.

References Sabre\DAV\Mock\SharedNode\$invites.

120  {
121 
122  return $this->invites;
123 
124  }

◆ getName()

Sabre\DAV\Mock\SharedNode::getName ( )

Returns the name of the node.

This is used to generate the url.

Returns
string

Implements Sabre\DAV\INode.

Definition at line 21 of file SharedNode.php.

References Sabre\DAV\Mock\SharedNode\$name.

21  {
22 
23  return $this->name;
24 
25  }

◆ getShareAccess()

Sabre\DAV\Mock\SharedNode::getShareAccess ( )

Returns the 'access level' for the instance of this shared resource.

The value should be one of the Sabre::ACCESS_ constants.

Returns
int

Implements Sabre\DAV\Sharing\ISharedNode.

Definition at line 35 of file SharedNode.php.

References Sabre\DAV\Mock\SharedNode\$access.

35  {
36 
37  return $this->access;
38 
39  }

◆ getShareResourceUri()

Sabre\DAV\Mock\SharedNode::getShareResourceUri ( )

This function must return a URI that uniquely identifies the shared resource.

This URI should be identical across instances, and is also used in several other XML bodies to connect invites to resources.

This may simply be a relative reference to the original shared instance, but it could also be a urn. As long as it's a valid URI and unique.

Returns
string

Implements Sabre\DAV\Sharing\ISharedNode.

Definition at line 52 of file SharedNode.php.

52  {
53 
54  return 'urn:example:bar';
55 
56  }

◆ updateInvites()

Sabre\DAV\Mock\SharedNode::updateInvites ( array  $sharees)

Updates the list of sharees.

Every item must be a Sharee object.

Parameters
Sharee[]$sharees
Returns
void

Implements Sabre\DAV\Sharing\ISharedNode.

Definition at line 66 of file SharedNode.php.

References Sabre\DAV\Sharing\Plugin\INVITE_NORESPONSE.

66  {
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  }

Field Documentation

◆ $access

Sabre\DAV\Mock\SharedNode::$access
protected

◆ $invites

Sabre\DAV\Mock\SharedNode::$invites = []
protected

Definition at line 12 of file SharedNode.php.

Referenced by Sabre\DAV\Mock\SharedNode\getInvites().

◆ $name

Sabre\DAV\Mock\SharedNode::$name
protected

The documentation for this class was generated from the following file: