Elgg  Version 5.1
Public Member Functions | Protected Attributes | List of all members
Elgg\UserCapabilities Class Reference

User capabilities service. More...

Public Member Functions

 __construct (EventsService $events, EntityTable $entities, SessionManagerService $session_manager)
 Constructor. More...
 
 canBypassPermissionsCheck (int $user_guid=0)
 Decides if the access system should be ignored for a user. More...
 
 canEdit (\ElggEntity $entity, int $user_guid=0)
 Can a user edit this entity? More...
 
 canDelete (\ElggEntity $entity, int $user_guid=0)
 Can a user delete this entity? More...
 
 canDeleteRiverItem (\ElggRiverItem $item, int $user_guid=0)
 Can a user delete this river item? More...
 
 canEditAnnotation (\ElggEntity $entity, int $user_guid=0,\ElggAnnotation $annotation=null)
 Determines whether or not the user can edit this annotation. More...
 
 canWriteToContainer (\ElggEntity $entity, string $type, string $subtype, int $user_guid=0)
 Can a user add an entity to this container. More...
 
 canComment (\ElggEntity $entity, int $user_guid=0)
 Can a user comment on an entity? More...
 
 canAnnotate (\ElggEntity $entity, int $user_guid=0, string $annotation_name= '')
 Can a user annotate an entity? More...
 
 canDownload (\ElggFile $entity, int $user_guid=0, bool $default=true)
 Can a user download a file? More...
 

Protected Attributes

 $events
 
 $entities
 
 $session_manager
 

Detailed Description

User capabilities service.

Definition at line 14 of file UserCapabilities.php.

Constructor & Destructor Documentation

Elgg\UserCapabilities::__construct ( EventsService  $events,
EntityTable  $entities,
SessionManagerService  $session_manager 
)

Constructor.

Parameters
EventsService$eventsEvents service
EntityTable$entitiesEntity table
SessionManagerService$session_managerSession

Definition at line 38 of file UserCapabilities.php.

Member Function Documentation

Elgg\UserCapabilities::canAnnotate ( \ElggEntity  $entity,
int  $user_guid = 0,
string  $annotation_name = '' 
)

Can a user annotate an entity?

Can be overridden by registering for the event [permissions_check:annotate:<name>, <entity type>="">] or [permissions_check:annotate, <entity type>="">]. The events are called in that order.

If you want logged out users to annotate an object, do not call canAnnotate(). It's easier than using the event.

Parameters
\ElggEntity$entityObjet entity
int$user_guidUser guid (default is logged in user)
string$annotation_nameThe name of the annotation (default is unspecified)
Returns
bool

Definition at line 338 of file UserCapabilities.php.

Elgg\UserCapabilities::canBypassPermissionsCheck ( int  $user_guid = 0)

Decides if the access system should be ignored for a user.

Returns true (meaning ignore access) if either of these 2 conditions are true: 1) an admin user guid is passed to this function. 2) elgg_get_ignore_access() returns true.

Parameters
int$user_guidThe user to check against.
Returns
bool

Definition at line 55 of file UserCapabilities.php.

Elgg\UserCapabilities::canComment ( \ElggEntity  $entity,
int  $user_guid = 0 
)

Can a user comment on an entity?

Can be overridden by registering for the permissions_check:comment, <entity type>=""> event.

Parameters
\ElggEntity$entityObject entity
int$user_guidUser guid (default is logged in user)
Returns
bool

Definition at line 301 of file UserCapabilities.php.

Elgg\UserCapabilities::canDelete ( \ElggEntity  $entity,
int  $user_guid = 0 
)

Can a user delete this entity?

Can be overridden by registering for the 'permissions_check:delete' event.

Parameters
\ElggEntity$entityObject entity
int$user_guidThe user GUID, optionally (default: logged in user)
Returns
bool Whether this entity is deletable by the given user.
Since
1.11

Definition at line 140 of file UserCapabilities.php.

Elgg\UserCapabilities::canDeleteRiverItem ( \ElggRiverItem  $item,
int  $user_guid = 0 
)

Can a user delete this river item?

Can be overridden by registering for the "permissions_check:delete", "river" event.

Parameters
\ElggRiverItem$itemRiver item
int$user_guidThe user GUID, optionally (default: logged in user)
Returns
bool Whether this river item should be considered deletable by the given user.
Since
2.3

Definition at line 171 of file UserCapabilities.php.

Elgg\UserCapabilities::canDownload ( \ElggFile  $entity,
int  $user_guid = 0,
bool  $default = true 
)

Can a user download a file?

Can be overridden by registering for the 'permissions_check:download', 'file' event.

Parameters
\ElggFile$entityFile entity
int$user_guidUser guid (default is logged in user)
bool$defaultDefault permission
Returns
bool

Definition at line 375 of file UserCapabilities.php.

Elgg\UserCapabilities::canEdit ( \ElggEntity  $entity,
int  $user_guid = 0 
)

Can a user edit this entity?

Can be overridden by registering for the 'permissions_check' event.

Parameters
\ElggEntity$entityObject entity
int$user_guidThe user GUID, optionally (default: logged in user)
Returns
bool Whether this entity is editable by the given user.

Definition at line 81 of file UserCapabilities.php.

Elgg\UserCapabilities::canEditAnnotation ( \ElggEntity  $entity,
int  $user_guid = 0,
\ElggAnnotation  $annotation = null 
)

Determines whether or not the user can edit this annotation.

Parameters
\Elggentity$entityObject entity
int$user_guidThe GUID of the user (defaults to currently logged in user)
\ElggAnnotation$annotationAnnotation
Returns
bool

Definition at line 198 of file UserCapabilities.php.

Elgg\UserCapabilities::canWriteToContainer ( \ElggEntity  $entity,
string  $type,
string  $subtype,
int  $user_guid = 0 
)

Can a user add an entity to this container.

Parameters
\ElggEntity$entityContainer entity
string$typeThe type of entity we're looking to write
string$subtypeThe subtype of the entity we're looking to write
int$user_guidThe GUID of the user creating the entity (0 for logged in user).
Returns
bool

Definition at line 247 of file UserCapabilities.php.

Member Data Documentation

Elgg\UserCapabilities::$entities
protected

Definition at line 24 of file UserCapabilities.php.

Elgg\UserCapabilities::$events
protected

Definition at line 19 of file UserCapabilities.php.

Elgg\UserCapabilities::$session_manager
protected

Definition at line 29 of file UserCapabilities.php.


The documentation for this class was generated from the following file: