PHP Class Horde_Share_Sql, horde

Inheritance: extends Horde_Share_Base
Afficher le fichier Open project: horde/horde Class Usage Examples

Protected Properties

Свойство Type Description
$_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.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
_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.

Method Details

__construct() public méthode

See also: 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() protected méthode

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() protected méthode

Builds a permission bit mask from the "perm" column.
protected _buildPermsFromRow ( array $row ) : integer
$row array A data row including permission columns.
Résultat integer A permission mask.

_convertClobs() protected méthode

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

_createObject() protected méthode

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

_exists() protected méthode

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

_fetchClobFields() protected méthode

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

_fromDriverCharset() protected méthode

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

_getClobFields() protected méthode

Return a list of fields in the table that ARE text/clob fields.
protected _getClobFields ( ) : array
Résultat array An array of clob field names.

_getDistinctClause() protected méthode

Return a DISTINCT clause containing all non-clob field names.
protected _getDistinctClause ( ) : string
Résultat string The DISTINCT clause.

_getNonClobFields() protected méthode

Return a list of fields in the table that are NOT text/clob fields.
protected _getNonClobFields ( ) : array
Résultat array An array of non-clob field names.

_getShare() protected méthode

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.
Résultat Horde_Share_Object The requested share.

_getShareById() protected méthode

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.
Résultat Horde_Share_Object_sql The requested share.

_getShareGroups() protected méthode

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

_getSharePerms() protected méthode

protected _getSharePerms ( &$data )

_getShareUsers() protected méthode

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

_getShares() protected méthode

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.
Résultat array The requested shares.

_getUserAndGroupCriteria() protected méthode

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.
Résultat array An array with query and where string fragments.

_hasGroups() protected méthode

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

_hasUsers() protected méthode

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

_idExists() protected méthode

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

_listAllShares() protected méthode

Lists *all* shares for the current app/share, regardless of permissions.
protected _listAllShares ( ) : array
Résultat array All shares for the current app/share.

_listShares() protected méthode

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().
Résultat array The shares the user has access to.

_loadPermissions() protected méthode

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

_newShare() protected méthode

Returns a new share object.
protected _newShare ( string $name ) : Horde_Share_Object
$name string The share's name.
Résultat Horde_Share_Object A new share object

_removeShare() protected méthode

Removes a share from the shares system permanently.
protected _removeShare ( Horde_Share_Object $share ) : boolean
$share Horde_Share_Object The share to remove.
Résultat boolean

_renameShare() protected méthode

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() protected méthode

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.
Résultat array The driver keyed array.

countOwners() public méthode

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?
Résultat integer Number of users.

countShares() public méthode

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?
Résultat integer Number of shares the user has access to.

getParent() public méthode

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.
Résultat Horde_Share_Object The parent share, if it exists.

getShareCriteria() public méthode

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.
Résultat string The criteria string for fetching this user's shares.

getStorage() public méthode

public getStorage ( ) : Horde_Db_Adapter
Résultat Horde_Db_Adapter

getTable() public méthode

Get storage table
public getTable ( ) : string
Résultat string

listAllShares() public méthode

This is for admin functionality and scripting tools, and shouldn't be called from user-level code!
public listAllShares ( ) : array
Résultat array All shares for the current app/share.

listOwners() public méthode

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.
Résultat array List of users.

listShares() public méthode

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?
Résultat array The shares the user has access to.

listSystemShares() public méthode

Returns an array of all system shares.
public listSystemShares ( ) : array
Résultat array All system shares.

removeShare() public méthode

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

setStorage() public méthode

public setStorage ( Horde_Db_Adapter $db )
$db Horde_Db_Adapter

setTable() public méthode

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

toDriverCharset() public méthode

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

Property Details

$_clobFields protected_oe property

Local cache of text/clob fields
protected array $_clobFields
Résultat array

$_db protected_oe property

Handle for the current database connection.
protected Horde_Db_Adapter $_db
Résultat Horde_Db_Adapter

$_nonClobFields protected_oe property

Local cache of non-text/clob fields
protected array $_nonClobFields
Résultat array

$_shareObject protected_oe property

The Horde_Share_Object subclass to instantiate objects as
protected string $_shareObject
Résultat string

$_table protected_oe property

Main share table for the current scope.
protected string $_table
Résultat string