ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAVACL\Exception\NeedPrivileges Class Reference

NeedPrivileges. More...

+ Inheritance diagram for Sabre\DAVACL\Exception\NeedPrivileges:
+ Collaboration diagram for Sabre\DAVACL\Exception\NeedPrivileges:

Public Member Functions

 __construct ($uri, array $privileges)
 Constructor. More...
 
 serialize (DAV\Server $server, \DOMElement $errorNode)
 Adds in extra information in the xml response. More...
 
- Public Member Functions inherited from Sabre\DAV\Exception\Forbidden
 getHTTPCode ()
 Returns the HTTP statuscode for this exception. More...
 
- Public Member Functions inherited from Sabre\DAV\Exception
 getHTTPCode ()
 Returns the HTTP statuscode for this exception. More...
 
 serialize (Server $server, \DOMElement $errorNode)
 This method allows the exception to include additional information into the WebDAV error response. More...
 
 getHTTPHeaders (Server $server)
 This method allows the exception to return any extra HTTP response headers. More...
 

Protected Attributes

 $uri
 
 $privileges
 

Detailed Description

NeedPrivileges.

The 403-need privileges is thrown when a user didn't have the appropriate permissions to perform an operation

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

Definition at line 17 of file NeedPrivileges.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\DAVACL\Exception\NeedPrivileges::__construct (   $uri,
array  $privileges 
)

Constructor.

Parameters
string$uri
array$privileges

Definition at line 39 of file NeedPrivileges.php.

References Sabre\DAVACL\Exception\NeedPrivileges\$privileges, and Sabre\DAVACL\Exception\NeedPrivileges\$uri.

39  {
40 
41  $this->uri = $uri;
42  $this->privileges = $privileges;
43 
44  parent::__construct('User did not have the required privileges (' . implode(',', $privileges) . ') for path "' . $uri . '"');
45 
46  }

Member Function Documentation

◆ serialize()

Sabre\DAVACL\Exception\NeedPrivileges::serialize ( DAV\Server  $server,
\DOMElement  $errorNode 
)

Adds in extra information in the xml response.

This method adds the {DAV:}need-privileges element as defined in rfc3744

Parameters
DAV\Server$server
\DOMElement$errorNode
Returns
void

Definition at line 57 of file NeedPrivileges.php.

References Sabre\DAVACL\Exception\NeedPrivileges\$uri.

57  {
58 
59  $doc = $errorNode->ownerDocument;
60 
61  $np = $doc->createElementNS('DAV:', 'd:need-privileges');
62  $errorNode->appendChild($np);
63 
64  foreach ($this->privileges as $privilege) {
65 
66  $resource = $doc->createElementNS('DAV:', 'd:resource');
67  $np->appendChild($resource);
68 
69  $resource->appendChild($doc->createElementNS('DAV:', 'd:href', $server->getBaseUri() . $this->uri));
70 
71  $priv = $doc->createElementNS('DAV:', 'd:privilege');
72  $resource->appendChild($priv);
73 
74  preg_match('/^{([^}]*)}(.*)$/', $privilege, $privilegeParts);
75  $priv->appendChild($doc->createElementNS($privilegeParts[1], 'd:' . $privilegeParts[2]));
76 
77 
78  }
79 
80  }
$server
Definition: sabredav.php:48

Field Documentation

◆ $privileges

Sabre\DAVACL\Exception\NeedPrivileges::$privileges
protected

◆ $uri

Sabre\DAVACL\Exception\NeedPrivileges::$uri
protected

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