1<?php 2 3declare(strict_types=1); 4 5namespace Sabre\DAVACL\FS; 6 7use Sabre\DAV\FSExt\File as BaseFile; 8use Sabre\DAVACL\ACLTrait; 9use Sabre\DAVACL\IACL; 10 11/** 12 * This is an ACL-enabled file node. 13 * 14 * @copyright Copyright (C) fruux GmbH (https://fruux.com/) 15 * @author Evert Pot (http://evertpot.com/) 16 * @license http://sabre.io/license/ Modified BSD License 17 */ 18class File extends BaseFile implements IACL 19{ 20 use ACLTrait; 21 22 /** 23 * A list of ACL rules. 24 * 25 * @var array 26 */ 27 protected $acl; 28 29 /** 30 * Owner uri, or null for no owner. 31 * 32 * @var string|null 33 */ 34 protected $owner; 35 36 /** 37 * Constructor. 38 * 39 * @param string $path on-disk path 40 * @param array $acl ACL rules 41 * @param string|null $owner principal owner string 42 */ 43 public function __construct($path, array $acl, $owner = null) 44 { 45 parent::__construct($path); 46 $this->acl = $acl; 47 $this->owner = $owner; 48 } 49 50 /** 51 * Returns the owner principal. 52 * 53 * This must be a url to a principal, or null if there's no owner 54 * 55 * @return string|null 56 */ 57 public function getOwner() 58 { 59 return $this->owner; 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 public function getACL() 75 { 76 return $this->acl; 77 } 78} 79