PHP Класс Horde_Share_Sql, horde

Наследование: extends Horde_Share_Base
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_clobFields array Local cache of text/clob fields
$_db Horde_Db_Adapter Handle for the current database connection.
$_nonClobFields array Local cache of non-text/clob fields
$_shareObject string The Horde_Share_Object subclass to instantiate objects as
$_table string Main share table for the current scope.

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

Метод Описание
__construct ( $app, $user, Horde_Perms_Base $perms, Horde_Group_Base $groups )
countOwners ( integer $perm = Horde_Perms::SHOW, mixed $parent = null, boolean $allLevels = true ) : integer Count the number of users who have shares with the given permissions for the current user.
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.
getParent ( Horde_Share_Object $child ) : Horde_Share_Object Returns a share's direct parent object.
getShareCriteria ( string $userid, integer $perm = Horde_Perms::SHOW, mixed $attributes = null, mixed $parent = null, boolean $allLevels = true ) : string Returns an array of criteria for querying shares.
getStorage ( ) : Horde_Db_Adapter
getTable ( ) : string Get storage table
listAllShares ( ) : array Lists *all* shares for the current app/share, regardless of permissions.
listOwners ( integer $perm = Horde_Perms::SHOW, mixed $parent = null, boolean $allLevels = true, integer $from, integer $count ) : array Return a list of users who have shares with the given permissions for the current user.
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.
removeShare ( Horde_Share_Object $share ) Removes a share from the shares system permanently.
setStorage ( Horde_Db_Adapter $db )
setTable ( $table ) Set the SQL table name to use for the current scope's share storage.
toDriverCharset ( $data ) Utility function to convert TO the SQL server's charset.

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

Метод Описание
_addShare ( Horde_Share_Object $share ) Adds a share to the shares system.
_buildPermsFromRow ( array $row ) : integer Builds a permission bit mask from the "perm" column.
_convertClobs ( &$data ) Convert clob data to string.
_createObject ( array $data = [] )
_exists ( string $share ) : boolean Checks if a share exists in the system.
_fetchClobFields ( &$shares ) Fetch data for all clob fields of each share passed in $shares.
_fromDriverCharset ( $data ) Utility function to convert from the SQL server's charset.
_getClobFields ( ) : array Return a list of fields in the table that ARE text/clob fields.
_getDistinctClause ( ) : string Return a DISTINCT clause containing all non-clob field names.
_getNonClobFields ( ) : array Return a list of fields in the table that are NOT text/clob fields.
_getShare ( string $name ) : Horde_Share_Object Returns a Horde_Share_Object_sql 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.
_getShareGroups ( array &$share ) Get groups permissions
_getSharePerms ( &$data )
_getShareUsers ( array &$share ) Get users permissions
_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.
_getUserAndGroupCriteria ( string $userid, integer $perm = Horde_Perms::SHOW ) : array Returns criteria statement fragments for querying shares.
_hasGroups ( $share ) Finds out if the share has user set
_hasUsers ( $share ) Finds out if the share has user set
_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.
_loadPermissions ( array &$data ) Helper function to load the permissions data into the share data
_newShare ( string $name ) : Horde_Share_Object Returns a new share object.
_removeShare ( Horde_Share_Object $share ) : boolean Removes a share from the shares system permanently.
_renameShare ( Horde_Share_Object $share, string $name ) Renames a share in the shares system.
_toDriverKeys ( array $data ) : array Convert an array keyed on client keys to an array keyed on the driver keys.

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

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

См. также: Horde_Share_Base::__construct()
public __construct ( $app, $user, Horde_Perms_Base $perms, Horde_Group_Base $groups )
$perms Horde_Perms_Base
$groups Horde_Group_Base

_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.
protected _addShare ( Horde_Share_Object $share )
$share Horde_Share_Object The new share object.

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

Builds a permission bit mask from the "perm" column.
protected _buildPermsFromRow ( array $row ) : integer
$row array A data row including permission columns.
Результат integer A permission mask.

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

Convert clob data to string.
protected _convertClobs ( &$data )

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

protected _createObject ( array $data = [] )
$data array

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

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

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

Fetch data for all clob fields of each share passed in $shares.
protected _fetchClobFields ( &$shares )

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

Utility function to convert from the SQL server's charset.
protected _fromDriverCharset ( $data )

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

Return a list of fields in the table that ARE text/clob fields.
protected _getClobFields ( ) : array
Результат array An array of clob field names.

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

Return a DISTINCT clause containing all non-clob field names.
protected _getDistinctClause ( ) : string
Результат string The DISTINCT clause.

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

Return a list of fields in the table that are NOT text/clob fields.
protected _getNonClobFields ( ) : array
Результат array An array of non-clob field names.

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

Returns a Horde_Share_Object_sql 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.
Результат Horde_Share_Object The requested share.

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

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.
Результат Horde_Share_Object_sql The requested share.

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

Get groups permissions
protected _getShareGroups ( array &$share )
$share array Share data array

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

protected _getSharePerms ( &$data )

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

Get users permissions
protected _getShareUsers ( array &$share )
$share array Share data array

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

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

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

Returns criteria statement fragments for querying shares.
protected _getUserAndGroupCriteria ( string $userid, integer $perm = Horde_Perms::SHOW ) : array
$userid string The userid of the user to check access for.
$perm integer The level of permissions required.
Результат array An array with query and where string fragments.

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

Finds out if the share has user set
protected _hasGroups ( $share )

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

Finds out if the share has user set
protected _hasUsers ( $share )

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

Check that a share id exists in the system.
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.
protected _listAllShares ( ) : array
Результат array All shares for the current app/share.

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

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().
Результат array The shares the user has access to.

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

Helper function to load the permissions data into the share data
protected _loadPermissions ( array &$data )
$data array Array of share attributes

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

Returns a new share object.
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.
protected _removeShare ( Horde_Share_Object $share ) : boolean
$share Horde_Share_Object The share to remove.
Результат boolean

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

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.

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

Convert an array keyed on client keys to an array keyed on the driver keys.
protected _toDriverKeys ( array $data ) : array
$data array The client code keyed array.
Результат array The driver keyed array.

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

Count the number of users who have shares with the given permissions for the current user.
public countOwners ( integer $perm = Horde_Perms::SHOW, mixed $parent = null, boolean $allLevels = true ) : integer
$perm integer The level of permissions required.
$parent mixed The parent share to start looking in. (Horde_Share_Object, share_id, or null).
$allLevels boolean Return all levels, or just the direct children of $parent?
Результат integer Number of users.

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

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?
Результат integer Number of shares the user has access to.

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

Returns a share's direct parent object.
public getParent ( Horde_Share_Object $child ) : Horde_Share_Object
$child Horde_Share_Object The share to get parent for.
Результат Horde_Share_Object The parent share, if it exists.

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

Returns an array of criteria for querying shares.
public getShareCriteria ( string $userid, integer $perm = Horde_Perms::SHOW, mixed $attributes = null, mixed $parent = null, boolean $allLevels = true ) : string
$userid string The userid of the user to check access for.
$perm integer The level of permissions required. Set to null to skip permission filtering.
$attributes mixed Restrict the shares returned to those who have these attribute values.
$parent mixed The share to start searching in. (A Horde_Share_Object, share_id or null)
$allLevels boolean Return all levels, or just the direct children of $parent? Defaults to all levels.
Результат string The criteria string for fetching this user's shares.

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

public getStorage ( ) : Horde_Db_Adapter
Результат Horde_Db_Adapter

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

Get storage table
public getTable ( ) : string
Результат string

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.

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

Return a list of users who have shares with the given permissions for the current user.
public listOwners ( integer $perm = Horde_Perms::SHOW, mixed $parent = null, boolean $allLevels = true, integer $from, integer $count ) : array
$perm integer The level of permissions required.
$parent mixed The parent share to start looking in. (Horde_Share_Object, share_id, or null)
$allLevels boolean Return all levels, or just the direct children of $parent? Defaults to all levels.
$from integer The user to start listing at.
$count integer The number of users to return.
Результат array List of users.

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.
 'attribtues'    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.
 'parent'        Start at this share in the hierarchy. Either share_id or
                 Horde_Share_Object
 'all_levels'    List all levels or just the direct children of parent?
Результат array The shares the user has access to.

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

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

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

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

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

public setStorage ( Horde_Db_Adapter $db )
$db Horde_Db_Adapter

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

Set the SQL table name to use for the current scope's share storage.
public setTable ( $table )

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

Utility function to convert TO the SQL server's charset.
public toDriverCharset ( $data )

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

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

Local cache of text/clob fields
protected array $_clobFields
Результат array

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

Handle for the current database connection.
protected Horde_Db_Adapter $_db
Результат Horde_Db_Adapter

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

Local cache of non-text/clob fields
protected array $_nonClobFields
Результат array

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

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

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

Main share table for the current scope.
protected string $_table
Результат string