ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAVACL\FS\HomeCollection Class Reference

This collection contains a collection for every principal. More...

+ Inheritance diagram for Sabre\DAVACL\FS\HomeCollection:
+ Collaboration diagram for Sabre\DAVACL\FS\HomeCollection:

Public Member Functions

 __construct (BackendInterface $principalBackend, $storagePath, $principalPrefix='principals')
 Creates the home collection. More...
 
 getName ()
 Returns the name of the node. More...
 
 getChildForPrincipal (array $principalInfo)
 Returns a principals' collection of files. More...
 
 getACL ()
 Returns a list of ACE's for this node. More...
 
- Public Member Functions inherited from Sabre\DAVACL\AbstractPrincipalCollection
 __construct (PrincipalBackend\BackendInterface $principalBackend, $principalPrefix='principals')
 Creates the object. More...
 
 getChildForPrincipal (array $principalInfo)
 This method returns a node for a principal. More...
 
 getName ()
 Returns the name of this collection. More...
 
 getChildren ()
 Return the list of users. More...
 
 getChild ($name)
 Returns a child object, by its name. More...
 
 searchPrincipals (array $searchProperties, $test='allof')
 This method is used to search for principals matching a set of properties. More...
 
 findByUri ($uri)
 Finds a principal by its URI. More...
 
- Public Member Functions inherited from Sabre\DAV\Collection
 getChild ($name)
 Returns a child object, by its name. More...
 
 childExists ($name)
 Checks is a child-node exists. More...
 
 createFile ($name, $data=null)
 Creates a new file in the directory. More...
 
 createDirectory ($name)
 Creates a new subdirectory. 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...
 
- Public Member Functions inherited from Sabre\DAVACL\IACL
 getOwner ()
 Returns the owner principal. More...
 
 getGroup ()
 Returns a group principal. More...
 
 setACL (array $acl)
 Updates the ACL. More...
 
 getSupportedPrivilegeSet ()
 Returns the list of supported privileges for this node. More...
 

Data Fields

 $collectionName = 'home'
 
- Data Fields inherited from Sabre\DAVACL\AbstractPrincipalCollection
 $disableListing = false
 

Protected Attributes

 $storagePath
 
- Protected Attributes inherited from Sabre\DAVACL\AbstractPrincipalCollection
 $principalBackend
 
 $principalPrefix
 

Detailed Description

This collection contains a collection for every principal.

It is similar to /home on many unix systems.

The per-user collections can only be accessed by the user who owns the collection.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 22 of file HomeCollection.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAVACL\FS\HomeCollection::__construct ( BackendInterface  $principalBackend,
  $storagePath,
  $principalPrefix = 'principals' 
)

Creates the home collection.

Parameters
BackendInterface$principalBackend
string$storagePathWhere the actual files are stored.
string$principalPrefixlist of principals to iterate.

Definition at line 47 of file HomeCollection.php.

References Sabre\DAVACL\AbstractPrincipalCollection\$principalPrefix, and Sabre\DAVACL\FS\HomeCollection\$storagePath.

Member Function Documentation

◆ getACL()

Sabre\DAVACL\FS\HomeCollection::getACL ( )

Returns a list of ACE's for this node.

Each ACE has the following properties:

  • 'privilege', a string such as {DAV:}read or {DAV:}write. These are currently the only supported privileges
  • 'principal', a url to the principal who owns the node
  • 'protected' (optional), indicating that this ACE is not allowed to be updated.
Returns
array

Implements Sabre\DAVACL\IACL.

Definition at line 116 of file HomeCollection.php.

116  {
117 
118  return [
119  [
120  'principal' => '{DAV:}authenticated',
121  'privilege' => '{DAV:}read',
122  'protected' => true,
123  ]
124  ];
125 
126  }

◆ getChildForPrincipal()

Sabre\DAVACL\FS\HomeCollection::getChildForPrincipal ( array  $principalInfo)

Returns a principals' collection of files.

The passed array contains principal information, and is guaranteed to at least contain a uri item. Other properties may or may not be supplied by the authentication backend.

Parameters
array$principalInfo
Returns

Definition at line 77 of file HomeCollection.php.

References $path, and Sabre\Uri\split().

77  {
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  }
$path
Definition: aliased.php:25
split($path)
Returns the 'dirname' and 'basename' for a path.
Definition: functions.php:279
+ Here is the call graph for this function:

◆ getName()

Sabre\DAVACL\FS\HomeCollection::getName ( )

Returns the name of the node.

This is used to generate the url.

Returns
string

Implements Sabre\DAV\INode.

Definition at line 61 of file HomeCollection.php.

References Sabre\DAVACL\FS\HomeCollection\$collectionName.

61  {
62 
63  return $this->collectionName;
64 
65  }

Field Documentation

◆ $collectionName

Sabre\DAVACL\FS\HomeCollection::$collectionName = 'home'

Definition at line 31 of file HomeCollection.php.

Referenced by Sabre\DAVACL\FS\HomeCollection\getName().

◆ $storagePath

Sabre\DAVACL\FS\HomeCollection::$storagePath
protected

Definition at line 38 of file HomeCollection.php.

Referenced by Sabre\DAVACL\FS\HomeCollection\__construct().


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