1<?php 2 3namespace Sabre\DAVACL\FS; 4 5use Sabre\DAV\FSExt\File as BaseFile; 6use Sabre\DAVACL\ACLTrait; 7use Sabre\DAVACL\IACL; 8 9/** 10 * This is an ACL-enabled file node. 11 * 12 * @copyright Copyright (C) fruux GmbH (https://fruux.com/) 13 * @author Evert Pot (http://evertpot.com/) 14 * @license http://sabre.io/license/ Modified BSD License 15 */ 16class File extends BaseFile implements IACL { 17 18 use ACLTrait; 19 20 /** 21 * A list of ACL rules. 22 * 23 * @var array 24 */ 25 protected $acl; 26 27 /** 28 * Owner uri, or null for no owner. 29 * 30 * @var string|null 31 */ 32 protected $owner; 33 34 /** 35 * Constructor 36 * 37 * @param string $path on-disk path. 38 * @param array $acl ACL rules. 39 * @param string|null $owner principal owner string. 40 */ 41 function __construct($path, array $acl, $owner = null) { 42 43 parent::__construct($path); 44 $this->acl = $acl; 45 $this->owner = $owner; 46 47 } 48 49 /** 50 * Returns the owner principal 51 * 52 * This must be a url to a principal, or null if there's no owner 53 * 54 * @return string|null 55 */ 56 function getOwner() { 57 58 return $this->owner; 59 60 } 61 62 /** 63 * Returns a list of ACE's for this node. 64 * 65 * Each ACE has the following properties: 66 * * 'privilege', a string such as {DAV:}read or {DAV:}write. These are 67 * currently the only supported privileges 68 * * 'principal', a url to the principal who owns the node 69 * * 'protected' (optional), indicating that this ACE is not allowed to 70 * be updated. 71 * 72 * @return array 73 */ 74 function getACL() { 75 76 return $this->acl; 77 78 } 79 80} 81