PHP Класс Horde_Share_Base, horde

Copyright 2002-2016 Horde LLC (http://www.horde.org/) Copyright 2002-2007 Infoteck Internet See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
Автор: Joel Vandal ([email protected])
Автор: Mike Cochrame ([email protected])
Автор: Chuck Hagenbuch ([email protected])
Автор: Jan Schneider ([email protected])
Автор: Gunnar Wrobel ([email protected])
Автор: Michael J. Rubinsky ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_app string The application we're managing shares for.
$_cache array A cache of all shares that have been retrieved, so we don't hit the backend again and again for them.
$_callbacks array modify - Called immediately before a share object's changes are saved to storage. Receives the share object as a parameter. remove - Called immediately before a share is removed from storage. Receives the share object as a parameter. list - Called immediately after a list of shares is received from storage. Passed the userid, share list, and any parameters passed to the listShare call. Should return the (possibly modified) share list. @see listShares() for more info.
$_groups Horde_Group_Base The Horde_Group driver
$_listcache array Cache used for listShares().
$_logger Horde_Log_Logger Logger
$_permsObject Horde_Perms_Base The Horde_Perms object
$_root mixed The root of the Share tree.
$_shareCallback callback A callback that is passed to the share objects for setting the objects' Horde_Share object.
$_shareMap array Id-name-map of already cached share objects.
$_shareObject string The Horde_Share_Object subclass to instantiate objects as
$_sortList array A list of objects that we're currently sorting, for reference during the sorting algorithm.
$_user string The current user

Открытые методы

Метод Описание
__construct ( string $app, string $user, Horde_Perms_Base $perms, Horde_Group_Base $groups ) Constructor.
addCallback ( string $type, array $callback ) Add a callback to the collection
addShare ( Horde_Share_Object $share ) Adds a share to the shares system.
countShares ( string $userid, integer $perm = Horde_Perms::SHOW, mixed $attributes = null ) : integer Returns the number of shares that $userid has access to.
exists ( string $share ) : boolean Checks if a share name exists in the system.
expireListCache ( ) Expire the current list cache. This would be needed anytime a share is either added, deleted, had a change in owner, parent, or perms.
getApp ( ) : string Returns the application we're managing shares for.
getListCache ( ) : array Returns the share's list cache.
getPermissions ( mixed $share, string $user = null ) : mixed Finds out what rights the given user has to this object.
getPermsObject ( ) : Horde_Perms_Base Getter for Horde_Perms object
getShare ( string $name ) : Horde_Share_Object Returns a Horde_Share_Object object corresponding to the given share name, with the details retrieved appropriately.
getShareById ( string $cid ) : Horde_Share_Object Returns a Horde_Share_Object object corresponding to the given unique ID, with the details retrieved appropriately.
getShares ( array $cids ) : array Returns an array of Horde_Share_Object objects corresponding to the given set of unique IDs, with the details retrieved appropriately.
idExists ( integer $id ) : boolean Check that a share id exists in the system.
initShareObject ( Horde_Share_Object $object ) (Re)connects the share object to this share driver.
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.
listSystemShares ( ) : array Returns an array of all system shares.
newShare ( string $owner, string $share_name = '', string $name_attribute = '' ) : Horde_Share_Object 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.
resetCache ( ) Resets the internal caches.
runCallback ( string $type, array $params ) : mixed Give public access to call the share callbacks. Needed to run the callbacks from the Horde_Share_Object objects.
setListCache ( array $cache ) Set the list cache.
setLogger ( Horde_Log_Logger $logger ) Set a logger object.
setShareCallback ( $callback )
setShareClass ( $classname ) Set the class type to use for creating share objects.
toDriverCharset ( array $data ) Convert TO the storage driver's charset. Individual share objects should implement this method if needed.

Защищенные методы

Метод Описание
_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 object corresponding to the given share name, with the details retrieved appropriately.
_getShareById ( integer $id ) : Horde_Share_Object_sql Returns a Horde_Share_Object object corresponding to the given unique ID, with the details retrieved appropriately.
_getShares ( array $ids ) : array Returns an array of Horde_Share_Object objects corresponding to the given set of unique IDs, with the details retrieved appropriately.
_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 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.
_sortShares ( $a, $b ) Utility function to be used with uasort() for sorting arrays of Horde_Share objects.

Описание методов

__construct() публичный Метод

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() абстрактный защищенный Метод

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

_exists() абстрактный защищенный Метод

Checks if a share exists in the system.
abstract protected _exists ( string $share ) : boolean
$share string The share to check.
Результат boolean True if the share exists.

_getShare() абстрактный защищенный Метод

Returns a Horde_Share_Object object corresponding to the given share name, with the details retrieved appropriately.
abstract protected _getShare ( string $name ) : Horde_Share_Object
$name string The name of the share to retrieve.
Результат Horde_Share_Object The requested share.

_getShareById() абстрактный защищенный Метод

Returns a Horde_Share_Object object corresponding to the given unique ID, with the details retrieved appropriately.
abstract protected _getShareById ( integer $id ) : Horde_Share_Object_sql
$id integer The id of the share to retrieve.
Результат Horde_Share_Object_sql The requested share.

_getShares() абстрактный защищенный Метод

Returns an array of Horde_Share_Object objects corresponding to the given set of unique IDs, with the details retrieved appropriately.
abstract protected _getShares ( array $ids ) : array
$ids array The array of ids to retrieve.
Результат array The requested shares.

_idExists() абстрактный защищенный Метод

Check that a share id exists in the system.
abstract protected _idExists ( integer $id ) : boolean
$id integer The share id
Результат boolean True if the share exists.

_listAllShares() абстрактный защищенный Метод

Lists *all* shares for the current app/share, regardless of permissions.
abstract protected _listAllShares ( ) : array
Результат array All shares for the current app/share.

_listShares() абстрактный защищенный Метод

Returns an array of all shares that $userid has access to.
abstract protected _listShares ( string $userid, array $params = [] ) : array
$userid string The userid of the user to check access for.
$params array See listShares().
Результат array The shares the user has access to.

_newShare() абстрактный защищенный Метод

Returns a new share object.
abstract protected _newShare ( string $name ) : Horde_Share_Object
$name string The share's name.
Результат Horde_Share_Object A new share object

_removeShare() абстрактный защищенный Метод

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

_renameShare() абстрактный защищенный Метод

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

_sortShares() защищенный Метод

Example: uasort($list, array('Horde_Share', '_sortShares'));
protected _sortShares ( $a, $b )

addCallback() публичный Метод

Add a callback to the collection
public addCallback ( string $type, array $callback )
$type string
$callback array

addShare() публичный Метод

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

countShares() публичный Метод

Returns the number of shares that $userid has access to.
public countShares ( string $userid, integer $perm = Horde_Perms::SHOW, mixed $attributes = null ) : 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.
Результат integer The number of shares

exists() публичный Метод

Checks if a share name exists in the system.
public exists ( string $share ) : boolean
$share string The share name to check.
Результат boolean True if the share exists.

expireListCache() публичный Метод

Expire the current list cache. This would be needed anytime a share is either added, deleted, had a change in owner, parent, or perms.
public expireListCache ( )

getApp() публичный Метод

Returns the application we're managing shares for.
public getApp ( ) : string
Результат string The application this share belongs to.

getListCache() публичный Метод

Returns the share's list cache.
public getListCache ( ) : array
Результат array

getPermissions() публичный Метод

Finds out what rights the given user has to this object.
См. также: Horde_Perms::getPermissions
public getPermissions ( mixed $share, string $user = null ) : mixed
$share mixed The share that should be checked for the users permissions.
$user string The user to check for.
Результат mixed A bitmask of permissions, a permission value, or an array of permission values the user has, depending on the permission type and whether the permission value is ambiguous. False if there is no such permsission.

getPermsObject() публичный Метод

Getter for Horde_Perms object
public getPermsObject ( ) : Horde_Perms_Base
Результат Horde_Perms_Base

getShare() публичный Метод

Returns a Horde_Share_Object object corresponding to the given share name, with the details retrieved appropriately.
public getShare ( string $name ) : Horde_Share_Object
$name string The name of the share to retrieve.
Результат Horde_Share_Object The requested share.

getShareById() публичный Метод

Returns a Horde_Share_Object object corresponding to the given unique ID, with the details retrieved appropriately.
public getShareById ( string $cid ) : Horde_Share_Object
$cid string The id of the share to retrieve.
Результат Horde_Share_Object The requested share.

getShares() публичный Метод

Returns an array of Horde_Share_Object objects corresponding to the given set of unique IDs, with the details retrieved appropriately.
public getShares ( array $cids ) : array
$cids array The array of ids to retrieve.
Результат array The requested shares.

idExists() публичный Метод

Check that a share id exists in the system.
public idExists ( integer $id ) : boolean
$id integer The share id
Результат boolean True if the share exists.

initShareObject() публичный Метод

(Re)connects the share object to this share driver.
public initShareObject ( Horde_Share_Object $object )
$object Horde_Share_Object

listAllShares() публичный Метод

This is for admin functionality and scripting tools, and shouldn't be called from user-level code!
public listAllShares ( ) : array
Результат array All shares for the current app/share.

listShares() публичный Метод

Returns an array of all shares that $userid has access to.
public listShares ( string $userid, array $params = [] ) : array
$userid string The userid of the user to check access for. An empty value for the userid will only return shares with guest access.
$params array Additional parameters for the search.
 'perm'        Require this level of permissions. Horde_Perms constant.
 'attributes'  Restrict shares to these attributes. A hash or username.
 'from'        Offset. Start at this share
 'count'       Limit.  Only return this many.
 'sort_by'     Sort by attribute.
 'direction'   Sort by direction.
Результат array The shares the user has access to.

listSystemShares() публичный Метод

Returns an array of all system shares.
public listSystemShares ( ) : array
Результат array All system shares.

newShare() публичный Метод

Returns a new share object.
public newShare ( string $owner, string $share_name = '', string $name_attribute = '' ) : Horde_Share_Object
$owner string The share owner name.
$share_name string The share's name.
$name_attribute string The name displayed to the user.
Результат Horde_Share_Object A new share object.

removeShare() публичный Метод

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

renameShare() публичный Метод

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

resetCache() публичный Метод

Resets the internal caches.
public resetCache ( )

runCallback() публичный Метод

Give public access to call the share callbacks. Needed to run the callbacks from the Horde_Share_Object objects.
public runCallback ( string $type, array $params ) : mixed
$type string The callback to run
$params array The parameters to pass to the callback.
Результат mixed

setListCache() публичный Метод

Set the list cache.
public setListCache ( array $cache )
$cache array

setLogger() публичный Метод

Set a logger object.
public setLogger ( Horde_Log_Logger $logger )
$logger Horde_Log_Logger

setShareCallback() публичный Метод

public setShareCallback ( $callback )

setShareClass() публичный Метод

Set the class type to use for creating share objects.
public setShareClass ( $classname )

toDriverCharset() публичный Метод

Convert TO the storage driver's charset. Individual share objects should implement this method if needed.
public toDriverCharset ( array $data )
$data array Data to be converted.

Описание свойств

$_app защищенное свойство

The application we're managing shares for.
protected string $_app
Результат string

$_cache защищенное свойство

A cache of all shares that have been retrieved, so we don't hit the backend again and again for them.
protected array $_cache
Результат array

$_callbacks защищенное свойство

modify - Called immediately before a share object's changes are saved to storage. Receives the share object as a parameter. remove - Called immediately before a share is removed from storage. Receives the share object as a parameter. list - Called immediately after a list of shares is received from storage. Passed the userid, share list, and any parameters passed to the listShare call. Should return the (possibly modified) share list. @see listShares() for more info.
protected array $_callbacks
Результат array

$_groups защищенное свойство

The Horde_Group driver
protected Horde_Group_Base $_groups
Результат Horde_Group_Base

$_listcache защищенное свойство

Cache used for listShares().
protected array $_listcache
Результат array

$_logger защищенное свойство

Logger
protected Horde_Log_Logger $_logger
Результат Horde_Log_Logger

$_permsObject защищенное свойство

The Horde_Perms object
protected Horde_Perms_Base $_permsObject
Результат Horde_Perms_Base

$_root защищенное свойство

The root of the Share tree.
protected mixed $_root
Результат mixed

$_shareCallback защищенное свойство

A callback that is passed to the share objects for setting the objects' Horde_Share object.
protected callback $_shareCallback
Результат callback

$_shareMap защищенное свойство

Id-name-map of already cached share objects.
protected array $_shareMap
Результат array

$_shareObject защищенное свойство

The Horde_Share_Object subclass to instantiate objects as
protected string $_shareObject
Результат string

$_sortList защищенное свойство

A list of objects that we're currently sorting, for reference during the sorting algorithm.
protected array $_sortList
Результат array

$_user защищенное свойство

The current user
protected string $_user
Результат string