ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
HomeCollection.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Sabre\DAVACL\FS;
4 
9 use Sabre\Uri;
10 
23 
24  use ACLTrait;
25 
31  public $collectionName = 'home';
32 
38  protected $storagePath;
39 
48 
49  parent::__construct($principalBackend, $principalPrefix);
50  $this->storagePath = $storagePath;
51 
52  }
53 
61  function getName() {
62 
63  return $this->collectionName;
64 
65  }
66 
77  function getChildForPrincipal(array $principalInfo) {
78 
79  $owner = $principalInfo['uri'];
80  $acl = [
81  [
82  'privilege' => '{DAV:}all',
83  'principal' => '{DAV:}owner',
84  'protected' => true,
85  ],
86  ];
87 
88  list(, $principalBaseName) = Uri\split($owner);
89 
90  $path = $this->storagePath . '/' . $principalBaseName;
91 
92  if (!is_dir($path)) {
93  mkdir($path, 0777, true);
94  }
95  return new Collection(
96  $path,
97  $acl,
98  $owner
99  );
100 
101  }
102 
103 
116  function getACL() {
117 
118  return [
119  [
120  'principal' => '{DAV:}authenticated',
121  'privilege' => '{DAV:}read',
122  'protected' => true,
123  ]
124  ];
125 
126  }
127 
128 }
$path
Definition: aliased.php:25
getName()
Returns the name of the node.
getACL()
Returns a list of ACE&#39;s for this node.
This is an ACL-enabled collection.
Definition: Collection.php:18
split($path)
Returns the &#39;dirname&#39; and &#39;basename&#39; for a path.
Definition: functions.php:279
__construct(BackendInterface $principalBackend, $storagePath, $principalPrefix='principals')
Creates the home collection.
ACL-enabled node.
Definition: IACL.php:16
getChildForPrincipal(array $principalInfo)
Returns a principals&#39; collection of files.
This collection contains a collection for every principal.
Implement this interface to create your own principal backends.