PHP Class Horde_Share_Kolab, horde

Copyright 2004-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Author: Stuart Binge ([email protected])
Author: Gunnar Wrobel ([email protected])
Inheritance: extends Horde_Share_Base
显示文件 Open project: horde/horde Class Usage Examples

Public Methods

Method Description
__construct ( string $app, string $user, Horde_Perms_Base $perms, Horde_Group_Base $groups ) Constructor.
constructFolderName ( string $owner, string $subpath, string $prefix = null ) : string Construct the Kolab storage folder name based on the share name and owner attributes.
constructId ( string $owner, string $name, string $prefix = null ) : string Construct the ID from the owner name and the folder subpath.
countShares ( string $userid, integer $perm = Horde_Perms::SHOW, mixed $attributes = null, mixed $parent = null, boolean $allLevels = true ) : integer Returns the count of all shares that $userid has access to.
deleteAcl ( string $id, string $user ) : null Delete Kolab specific access rights for a share.
getAcl ( string $id ) : An Retrieve the Kolab specific access rights for a share.
getFolderNameElements ( string $folder ) : array Retrieve namespace information for a folder name.
getList ( ) : Horde_Kolab_Storage_List Return the Kolab storage folder list handler.
getStorage ( ) : Horde_Kolab_Storage Return the Kolab storage backend associated with this driver.
getType ( ) : string Return the type of folder this share driver will access in the Kolab storage backend (depends on the application calling the share driver).
listSystemShares ( ) : array Returns an array of all system shares.
save ( string $id, string $old_id, array $data ) : null Save share data to the storage backend.
setAcl ( string $id, string $user, string $acl ) : null Set the Kolab specific access rights for a share.
setStorage ( Horde_Kolab_Storage $storage ) : null Set the Kolab storage backend.

Protected Methods

Method Description
_addShare ( Horde_Share_Object $share ) Adds a share to the shares system.
_exists ( string $share ) : boolean Checks if a share exists in the system.
_getShare ( string $name ) : Horde_Share_Object Returns a Horde_Share_Object_Kolab object corresponding to the given share name, with the details retrieved appropriately.
_getShareById ( integer $id ) : Horde_Share_Object_sql Returns a Horde_Share_Object_sql object corresponding to the given unique ID, with the details retrieved appropriately.
_getShares ( array $ids ) : array Returns an array of Horde_Share_Object_kolab objects corresponding to the requested folders.
_idExists ( integer $id ) : boolean Check that a share id exists in the system.
_listAllShares ( ) : array Lists *all* shares for the current app/share, regardless of permissions.
_listShares ( string $userid, array $params = [] ) : array Returns an array of all shares that $userid has access to.
_newShare ( string $name ) : Horde_Share_Object_kolab Returns a new share object.
_removeShare ( Horde_Share_Object $share ) Removes a share from the shares system permanently.
_renameShare ( Horde_Share_Object $share, string $name ) Renames a share in the shares system.

Private Methods

Method Description
_createObject ( string $id, array $data = [] ) : Horde_Share_Object Returns a Horde_Share_Object_Kolab object corresponding to the given share name, with the details retrieved appropriately.
_idDecode ( string $id ) : string Decode a share ID.
_idDeconstruct ( string $id ) : array Deconstruct the ID elements from the ID string
_idEncode ( string $id ) : string Encode a share ID.

Method Details

__construct() public method

Constructor.
public __construct ( string $app, string $user, Horde_Perms_Base $perms, Horde_Group_Base $groups )
$app string The application that the shares belong to
$user string The current user
$perms Horde_Perms_Base The permissions object
$groups Horde_Group_Base The Horde_Group driver.

_addShare() protected method

The share must first be created with Horde_Share::newShare(), and have any initial details added to it, before this function is called.
protected _addShare ( Horde_Share_Object $share )
$share Horde_Share_Object The new share object.

_exists() protected method

Checks if a share exists in the system.
protected _exists ( string $share ) : boolean
$share string The share to check.
return boolean True if the share exists.

_getShare() protected method

Returns a Horde_Share_Object_Kolab object corresponding to the given share name, with the details retrieved appropriately.
protected _getShare ( string $name ) : Horde_Share_Object
$name string The name of the share to retrieve.
return Horde_Share_Object The requested share.

_getShareById() protected method

Returns a Horde_Share_Object_sql object corresponding to the given unique ID, with the details retrieved appropriately.
protected _getShareById ( integer $id ) : Horde_Share_Object_sql
$id integer The id of the share to retrieve.
return Horde_Share_Object_sql The requested share.

_getShares() protected method

Returns an array of Horde_Share_Object_kolab objects corresponding to the requested folders.
protected _getShares ( array $ids ) : array
$ids array The ids of the shares to fetch.
return array An array of Horde_Share_Object_kolab objects.

_idExists() protected method

Check that a share id exists in the system.
protected _idExists ( integer $id ) : boolean
$id integer The share id
return boolean True if the share exists.

_listAllShares() protected method

For the Kolab backend this cannot work in the same way as for the SQL based backend. Permissions are always handled by the backend automatically (IMAP ACLs) and cannot be disabled. listAllShares() is apparently used during command line scipts where it represents administrator access. This is possible on Kolab by using the "manager" user. In that case a standard listShares() authenticated as "manager" should be sufficient.
protected _listAllShares ( ) : array
return array All shares for the current app/share.

_listShares() protected method

Returns an array of all shares that $userid has access to.
protected _listShares ( string $userid, array $params = [] ) : array
$userid string The userid of the user to check access for.
$params array See listShares().
return array The shares the user has access to.

_newShare() protected method

Returns a new share object.
protected _newShare ( string $name ) : Horde_Share_Object_kolab
$name string The share's name.
return Horde_Share_Object_kolab A new share object.

_removeShare() protected method

Removes a share from the shares system permanently.
protected _removeShare ( Horde_Share_Object $share )
$share Horde_Share_Object The share to remove.

_renameShare() protected method

Renames a share in the shares system.
protected _renameShare ( Horde_Share_Object $share, string $name )
$share Horde_Share_Object The share to rename.
$name string The share's new name.

constructFolderName() public method

Construct the Kolab storage folder name based on the share name and owner attributes.
public constructFolderName ( string $owner, string $subpath, string $prefix = null ) : string
$owner string The owner of the share.
$subpath string The folder subpath.
$prefix string The namespace prefix.
return string The folder name for the Kolab backend.

constructId() public method

Construct the ID from the owner name and the folder subpath.
public constructId ( string $owner, string $name, string $prefix = null ) : string
$owner string The share owner.
$name string The name of the folder without the namespace prefix.
$prefix string The namespace prefix.
return string The encoded ID.

countShares() public method

Returns the count of all shares that $userid has access to.
public countShares ( string $userid, integer $perm = Horde_Perms::SHOW, mixed $attributes = null, mixed $parent = null, boolean $allLevels = true ) : integer
$userid string The userid of the user to check access for.
$perm integer The level of permissions required.
$attributes mixed Restrict the shares counted to those matching $attributes. An array of attribute/values pairs or a share owner username.
$parent mixed The share to start searching from (Horde_Share_Object, share_id, or null)
$allLevels boolean Return all levels, or just the direct children of $parent?
return integer Number of shares the user has access to.

deleteAcl() public method

Delete Kolab specific access rights for a share.
public deleteAcl ( string $id, string $user ) : null
$id string The share ID.
$user string The user to delete the ACL for
return null

getAcl() public method

Retrieve the Kolab specific access rights for a share.
public getAcl ( string $id ) : An
$id string The share ID.
return An array of rights.

getFolderNameElements() public method

Retrieve namespace information for a folder name.
public getFolderNameElements ( string $folder ) : array
$folder string The folder name.
return array A list of namespace prefix, the delimiter and the folder subpath.

getList() public method

Return the Kolab storage folder list handler.
public getList ( ) : Horde_Kolab_Storage_List
return Horde_Kolab_Storage_List The folder list handler.

getStorage() public method

Return the Kolab storage backend associated with this driver.
public getStorage ( ) : Horde_Kolab_Storage
return Horde_Kolab_Storage The Kolab storage driver.

getType() public method

Return the type of folder this share driver will access in the Kolab storage backend (depends on the application calling the share driver).
public getType ( ) : string
return string

listSystemShares() public method

Returns an array of all system shares.
public listSystemShares ( ) : array
return array All system shares.

save() public method

Save share data to the storage backend.
public save ( string $id, string $old_id, array $data ) : null
$id string The share id.
$old_id string The old share id.
$data array The share data.
return null

setAcl() public method

Set the Kolab specific access rights for a share.
public setAcl ( string $id, string $user, string $acl ) : null
$id string The share ID.
$user string The user to set the ACL for.
$acl string The ACL.
return null

setStorage() public method

Set the Kolab storage backend.
public setStorage ( Horde_Kolab_Storage $storage ) : null
$storage Horde_Kolab_Storage The Kolab storage handler.
return null