SQL_FLAG_USERS
SQL_FLAG_USERS
Base class for all Horde_Share drivers.
Copyright 2002-2017 Horde LLC (http://www.horde.org/) Copyright 2002-2007 Infoteck Internet webmaster@infoteck.qc.ca
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
$_callbacks : array
Configured callbacks. We currently support: <pre> add - Called immediately before a new share is added. Receives the share object as a parameter.
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.
__construct(string $app, string $user, \Horde_Perms_Base $perms, \Horde_Group_Base $groups)
Constructor.
string | $app | The application that the shares belong to. |
string | $user | The current user. |
\Horde_Perms_Base | $perms | The permissions object. |
\Horde_Group_Base | $groups | The Horde_Group driver. |
listShares(string $userid, array $params = array()) : array
Returns an array of all shares that $userid has access to.
string | $userid | The userid of the user to check access for. |
array | $params | 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. '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? |
The shares the user has access to.
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.
integer | $perm | The level of permissions required. |
mixed | $parent | The parent share to start looking in. (Horde_Share_Object, share_id, or null) |
boolean | $allLevels | Return all levels, or just the direct children of $parent? Defaults to all levels. |
integer | $from | The user to start listing at. |
integer | $count | The number of users to return. |
List of users.
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.
integer | $perm | The level of permissions required. |
mixed | $parent | The parent share to start looking in. (Horde_Share_Object, share_id, or null). |
boolean | $allLevels | Return all levels, or just the direct children of $parent? |
Number of users.
getParent(\Horde_Share_Object $child) : \Horde_Share_Object
Returns a share's direct parent object.
\Horde_Share_Object | $child | The share to get parent for. |
The parent share, if it exists.
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.
string | $userid | The userid of the user to check access for. |
integer | $perm | The level of permissions required. |
mixed | $attributes | Restrict the shares counted to those matching $attributes. An array of attribute/values pairs or a share owner username. |
mixed | $parent | The share to start searching from (Horde_Share_Object, share_id, or null) |
boolean | $allLevels | Return all levels, or just the direct children of $parent? |
Number of shares the user has access to.
removeShare(\Horde_Share_Object $share)
Removes a share from the shares system permanently.
\Horde_Share_Object | $share | The share to remove. |
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.
string | $userid | The userid of the user to check access for. |
integer | $perm | The level of permissions required. Set to null to skip permission filtering. |
mixed | $attributes | Restrict the shares returned to those who have these attribute values. |
mixed | $parent | The share to start searching in. (A Horde_Share_Object, share_id or null) |
boolean | $allLevels | Return all levels, or just the direct children of $parent? Defaults to all levels. |
The criteria string for fetching this user's shares.
initShareObject(\Horde_Share_Object $object)
Passes the available permissions to the share object.
\Horde_Share_Object | $object |
getShare(string $name) : \Horde_Share_Object
Returns a Horde_Share_Object object corresponding to the given share name, with the details retrieved appropriately.
string | $name | The name of the share to retrieve. |
The requested share.
getShareById(string $cid) : \Horde_Share_Object
Returns a Horde_Share_Object object corresponding to the given unique ID, with the details retrieved appropriately.
string | $cid | The id of the share to retrieve. |
The requested share.
newShare(string $owner, string $share_name = '', string $name_attribute = '') : \Horde_Share_Object
Returns a new share object.
string | $owner | The share owner name. |
string | $share_name | The share's name. |
string | $name_attribute | The name displayed to the user. |
A new share object.
addShare(\Horde_Share_Object $share)
Adds a share to the shares system.
The share must first be created with newShare(), and have any initial details added to it, before this function is called.
\Horde_Share_Object | $share | The new share object. |
fromHash(array $hash) : \Horde_Share_Object
Adds a share created from a hash.
array | $hash | A hash like exported from Horde_Share_Object#toHash(). |
A new share object.
renameShare(\Horde_Share_Object $share, string $name)
Renames a share in the shares system.
\Horde_Share_Object | $share | The share to rename. |
string | $name | The share's new name. |
getPermissions(mixed $share, string $user = null) : mixed
Finds out what rights the given user has to this object.
mixed | $share | The share that should be checked for the users permissions. |
string | $user | The user to check for. |
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.
_getShare(string $name) : \Horde_Share_Object
Returns a Horde_Share_Object object corresponding to the given share name, with the details retrieved appropriately.
string | $name | The name of the share to retrieve. |
The requested share.
_getShareById(integer $id) : \Horde_Share_Object_sql
Returns a Horde_Share_Object object corresponding to the given unique ID, with the details retrieved appropriately.
integer | $id | The id of the share to retrieve. |
Horde_Exception_NotFound
The requested share.
_newShare(string $name) : \Horde_Share_Object
Returns a new share object.
string | $name | The share's name. |
A new share object
_addShare(\Horde_Share_Object $share)
Adds a share to the shares system.
The share must first be created with Horde_Share_sql::_newShare(), and have any initial details added to it, before this function is called.
\Horde_Share_Object | $share | The new share object. |
_removeShare(\Horde_Share_Object $share)
Removes a share from the shares system permanently.
\Horde_Share_Object | $share | The share to remove. |
_renameShare(\Horde_Share_Object $share, string $name)
Renames a share in the shares system.
\Horde_Share_Object | $share | The share to rename. |
string | $name | The share's new name. |
_getUserAndGroupCriteria(string $userid, integer $perm = \Horde_Perms::SHOW) : array
Returns criteria statement fragments for querying shares.
string | $userid | The userid of the user to check access for. |
integer | $perm | The level of permissions required. |
An array with query and where string fragments.
_getUserAndGroupShares(string $userid, array $perms) : array
Returns the records and share IDs from the user and group tables that match the search criteria.
string | $userid | The userid of the user to check access for. |
array | $perms | The level of permissions required. |
A set of user, groups, and shareids.
_getShareCriteria(string $userid, array $perms, array $attributes, array $shareids = null, $parent = null, $allLevels = true) : string
Returns a criteria statement for querying shares.
string | $userid | The userid of the user to check access for. |
array | $perms | The level of permissions required. |
array | $attributes | Restrict the shares returned to those who have these attribute values. |
array | $shareids | Additional share IDs from user and group permissions. |
$parent | ||
$allLevels |
The criteria string for fetching this user's shares.