1<?php 2 3namespace Sabre\CalDAV\Schedule; 4 5use Sabre\CalDAV; 6use Sabre\DAV; 7use Sabre\DAVACL; 8 9/** 10 * The CalDAV scheduling outbox 11 * 12 * The outbox is mainly used as an endpoint in the tree for a client to do 13 * free-busy requests. This functionality is completely handled by the 14 * Scheduling plugin, so this object is actually mostly static. 15 * 16 * @copyright Copyright (C) fruux GmbH (https://fruux.com/) 17 * @author Evert Pot (http://evertpot.com/) 18 * @license http://sabre.io/license/ Modified BSD License 19 */ 20class Outbox extends DAV\Collection implements IOutbox { 21 22 use DAVACL\ACLTrait; 23 24 /** 25 * The principal Uri 26 * 27 * @var string 28 */ 29 protected $principalUri; 30 31 /** 32 * Constructor 33 * 34 * @param string $principalUri 35 */ 36 function __construct($principalUri) { 37 38 $this->principalUri = $principalUri; 39 40 } 41 42 /** 43 * Returns the name of the node. 44 * 45 * This is used to generate the url. 46 * 47 * @return string 48 */ 49 function getName() { 50 51 return 'outbox'; 52 53 } 54 55 /** 56 * Returns an array with all the child nodes 57 * 58 * @return \Sabre\DAV\INode[] 59 */ 60 function getChildren() { 61 62 return []; 63 64 } 65 66 /** 67 * Returns the owner principal 68 * 69 * This must be a url to a principal, or null if there's no owner 70 * 71 * @return string|null 72 */ 73 function getOwner() { 74 75 return $this->principalUri; 76 77 } 78 79 /** 80 * Returns a list of ACE's for this node. 81 * 82 * Each ACE has the following properties: 83 * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are 84 * currently the only supported privileges 85 * * 'principal', a url to the principal who owns the node 86 * * 'protected' (optional), indicating that this ACE is not allowed to 87 * be updated. 88 * 89 * @return array 90 */ 91 function getACL() { 92 93 return [ 94 [ 95 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-send', 96 'principal' => $this->getOwner(), 97 'protected' => true, 98 ], 99 [ 100 'privilege' => '{DAV:}read', 101 'principal' => $this->getOwner(), 102 'protected' => true, 103 ], 104 [ 105 'privilege' => '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-send', 106 'principal' => $this->getOwner() . '/calendar-proxy-write', 107 'protected' => true, 108 ], 109 [ 110 'privilege' => '{DAV:}read', 111 'principal' => $this->getOwner() . '/calendar-proxy-read', 112 'protected' => true, 113 ], 114 [ 115 'privilege' => '{DAV:}read', 116 'principal' => $this->getOwner() . '/calendar-proxy-write', 117 'protected' => true, 118 ], 119 ]; 120 121 } 122 123} 124