kernel/private/classes/webdav/ezwebdavcontentbackendauth.php

Show: inherited
Table of Contents

File containing the eZWebDAVContentBackendAuth class.

Copyright
Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.  
License
eZ Business Use License Agreement Version 2.0  
Package
kernel  
Version
4.6.0  

\eZWebDAVContentBackendAuth

Package: Default

Basic authentication for WebDAV.

Parent(s)
?\ezcWebdavAnonymousAuthenticator\ezcWebdavBasicAuthenticator\ezcWebdavAuthorizer\ezcWebdavLockAuthorizer

Methods

methodpublicassignLock( string $user, string $lockToken ) : void

Assign a $lockToken to a given $user.

The authorization backend needs to save an arbitrary number of lock tokens per user. A lock token is a of maximum length 255 containing:

  • characters
  • numbers
  • dashes (-)
Parameters
Name Type Description
$user string
$lockToken string
methodpublicauthenticateAnonymous(  $data ) : void

Parameters
Name Type Description
$data
methodpublicauthenticateBasic( \ezcWebdavBasicAuth $data ) : bool

Checks authentication for the given $user.

This method checks the given user/password credentials encapsulated in $data. Returns true if the user was succesfully recognized and the password is valid for him, false otherwise. In case no username and/or password was provided in the request, empty strings are provided as the parameters of this method.

Parameters
Name Type Description
$data \ezcWebdavBasicAuth
Returns
Type Description
bool
methodpublicauthorize( string $user, string $path, int $access = self::ACCESS_READ ) : bool

Checks authorization of the given $user to a given $path.

This method checks if the given $user has the permission $access to the resource identified by $path. The $path is the result of a translation by the servers {@link ezcWebdavPathFactory} from the request URI.

The $access parameter can be one of

  • {@link ezcWebdavAuthorizer::ACCESS_WRITE}
  • {@link ezcWebdavAuthorizer::ACCESS_READ}

The implementation of this method must only check the given $path, but MUST not check descendant paths, since the back end will issue dedicated calls for such paths. In contrast, the algoritm MUST ensure, that parent permission constraints of the given $paths are met.

Examples: Permission is rejected for the paths "/a", "/b/beamme" and "/c/connect":

authorize( 'johndoe', '/a' ) ); // false
var_dump( $auth->authorize( 'johndoe', '/b' ) ); // true
var_dump( $auth->authorize( 'johndoe', '/b/beamme' ) ); // false
var_dump( $auth->authorize( 'johndoe', '/c/connect/some/deeper/path' ) ); // false
?>
Parameters
Name Type Description
$user string
$path string
$access int
Returns
Type Description
bool
methodpublicownsLock( string $user, string $lockToken ) : bool

Returns if the given $lockToken is owned by the given $user.

Returns true, if the $lockToken is owned by $user, false otherwise.

Parameters
Name Type Description
$user string
$lockToken string
Returns
Type Description
bool
methodpublicreleaseLock( string $user, string $lockToken ) : void

Removes the assignment of $lockToken from $user.

After a $lockToken has been released from the $user, the {@link ownsLock()} method must return false for the given combination. It might happen, that a lock is to be released, which already has been removed. This case must be ignored by the method.

Parameters
Name Type Description
$user string
$lockToken string
methodprotectedsplitFirstPathElement( string $path, string $element ) : string

Takes the first path element from \a $path and removes it from the path, the extracted part will be placed in \a $name.

$path = '/path/to/item/';
$newPath = self::splitFirstPathElement( $path, $root );
print( $root ); // prints 'path', $newPath is now 'to/item/'
$newPath = self::splitFirstPathElement( $newPath, $second );
print( $second ); // prints 'to', $newPath is now 'item/'
$newPath = self::splitFirstPathElement( $newPath, $third );
print( $third ); // prints 'item', $newPath is now ''
Parameters
Name Type Description
$path string

A path of elements delimited by a slash, if the path ends with a slash it will be removed

$element string

&$element The name of the first path element without any slashes

Returns
Type Description
string The rest of the path without the ending slash
Details
Todo
remove or replace  
Documentation was generated by DocBlox 0.18.1.