Constants

VERSION

VERSION

Serializable version.

Properties

$data

$data : array

The actual storage object that holds the data.

Type

array

$availablePermissions

$availablePermissions : 

A list of available permission.

This is necessary to unset certain permission when updating existing share objects.

Type

$_shareCallback

$_shareCallback : callback

A function to be called when a Horde_Share object is needed and not available.

Type

callback

$_shareOb

$_shareOb : \Horde_Share

The Horde_Share object which this share is associated with.

If this is empty, the $_shareCallback is called to obtain it.

Type

\Horde_Share

Methods

__construct()

__construct(array  $data) 

Constructor.

Parameters

array $data

Share data array.

serialize()

serialize() : string

Serialize this object.

Returns

string —

The serialized data.

unserialize()

unserialize(string  $data) 

Reconstruct the object from serialized data.

Parameters

string $data

The serialized data.

set()

set(string  $attribute, mixed  $value, boolean  $update = false) : boolean

Sets an attribute value in this object.

Parameters

string $attribute

The attribute to set.

mixed $value

The value for $attribute.

boolean $update

Immediately update only this change.

Returns

boolean

get()

get(string  $attribute) : mixed

Returns an attribute value from this object.

Parameters

string $attribute

The attribute to return.

Returns

mixed —

The value for $attribute.

getId()

getId() : string

Returns the ID of this share.

Returns

string —

The share's ID.

getName()

getName() : string

Returns the name of this share.

Returns

string —

The share's name.

countChildren()

countChildren(string  $user, integer  $perm = \Horde_Perms::SHOW, boolean  $allLevels = true) : integer

Return a count of the number of children this share has

Parameters

string $user

The user to use for checking perms

integer $perm

A Horde_Perms::* constant

boolean $allLevels

Count grandchildren or just children

Returns

integer —

The number of child shares

getChildren()

getChildren(string  $user, integer  $perm = \Horde_Perms::SHOW, boolean  $allLevels = true) : array

Get all children of this share.

Parameters

string $user

The user to use for checking perms

integer $perm

Horde_Perms::* constant. If NULL will return all shares regardless of permissions.

boolean $allLevels

Return all levels.

Returns

array —

An array of Horde_Share_Object objects

getParent()

getParent() : \Horde_Share_Object

Returns a child's direct parent

Returns

\Horde_Share_Object

The direct parent Horde_Share_Object

getParents()

getParents() : \array()

Get all of this share's parents.

Returns

\array() —

An array of Horde_Share_Objects

setParent()

setParent(mixed  $parent) : boolean

Set the parent object for this share.

Parameters

mixed $parent

A Horde_Share object or share id for the parent.

Returns

boolean

hasPermission()

hasPermission(string  $userid, integer  $permission, string  $creator = null) : boolean

Checks to see if a user has a given permission.

Parameters

string $userid

The userid of the user.

integer $permission

A Horde_Perms::* constant to test for.

string $creator

The creator of the event.

Returns

boolean —

Whether or not $userid has $permission.

setPermission()

setPermission(\Horde_Perms_Permission  $perm, boolean  $update = true) 

Sets the permission of this share.

Parameters

\Horde_Perms_Permission $perm

Permission object.

boolean $update

Should the share be saved after this operation?

getPermission()

getPermission() : \Horde_Perms_Permission

Returns the permission of this share.

Returns

\Horde_Perms_Permission —

Permission object that represents the permissions on this share.

setShareOb()

setShareOb(  $shareOb) 

Associates a Share object with this share, or provides a callback that knows how to provide it.

Parameters

$shareOb

getShareOb()

getShareOb() : \Horde_Share

Obtain this object's share driver.

Returns

\Horde_Share —

The share driver.

save()

save() : boolean

Saves the current attribute values.

Throws

\Horde_Exception

Returns

boolean

toHash()

toHash() : array

Exports the share object as a PHP hash.

Returns

array —

Hash representation of this share.

addUserPermission()

addUserPermission(string  $userid, integer  $permission) 

Gives a user a certain privilege for this share.

Parameters

string $userid

The userid of the user.

integer $permission

A Horde_Perms::* constant.

removeUserPermission()

removeUserPermission(string  $userid, integer  $permission) 

Removes a certain privilege for a user from this share.

Parameters

string $userid

The userid of the user.

integer $permission

A Horde_Perms::* constant.

addGroupPermission()

addGroupPermission(string  $group, integer  $permission) 

Gives a group certain privileges for this share.

Parameters

string $group

The group to add permissions for.

integer $permission

A Horde_Perms::* constant.

removeGroupPermission()

removeGroupPermission(string  $group, \constant  $permission) 

Removes a certain privilege from a group.

Parameters

string $group

The group to remove permissions from.

\constant $permission

A Horde_Perms::* constant.

removeUser()

removeUser(string  $userid) 

Removes a user from this share.

Parameters

string $userid

The userid of the user to remove.

removeGroup()

removeGroup(integer  $groupId) 

Removes a group from this share.

Parameters

integer $groupId

The group to remove.

listUsers()

listUsers(integer  $perm_level = null) : array

Returns an array containing all the userids of the users with access to this share.

Parameters

integer $perm_level

List only users with this permission level. Defaults to all users.

Returns

array —

The users with access to this share.

listGroups()

listGroups(integer  $perm_level = null) : array

Returns an array containing all the groupids of the groups with access to this share.

Parameters

integer $perm_level

List only users with this permission level. Defaults to all users.

Returns

array —

The IDs of the groups with access to this share.

addGuestPermission()

addGuestPermission(integer  $permission) 

Gives guests a certain privilege for this share.

Parameters

integer $permission

A Horde_Perms::* constant.

removeGuestPermission()

removeGuestPermission(integer  $permission) 

Removes a certain privilege for guests from this share.

Parameters

integer $permission

A Horde_Perms::* constant.

addCreatorPermission()

addCreatorPermission(integer  $permission) 

Gives creators a certain privilege for this share.

Parameters

integer $permission

A Horde_Perms::* constant.

removeCreatorPermission()

removeCreatorPermission(integer  $permission) 

Removes a certain privilege for creators from this share.

Parameters

integer $permission

A Horde_Perms::* constant.

addDefaultPermission()

addDefaultPermission(integer  $permission) 

Gives all authenticated users a certain privilege for this share.

Parameters

integer $permission

A Horde_Perms::* constant.

removeDefaultPermission()

removeDefaultPermission(integer  $permission) 

Removes a certain privilege for all authenticated users from this share.

Parameters

integer $permission

A Horde_Perms::* constant.

_save()

_save() 

Saves the current attribute values.

_getAttributes()

_getAttributes() : array

Returns the share attributes.

Returns

array —

All share attributes as a hash.

_setAvailablePermissions()

_setAvailablePermissions() 

Populates the $availablePermissions property with all seen permissions.

This is necessary because the share tables might be extended with arbitrary permissions.