Elgg
Version 6.1
|
Go to the source code of this file.
Functions | |
elgg_get_ignore_access () | |
Functions for Elgg's access system for entities, metadata, and annotations. More... | |
elgg_get_access_array (int $user_guid=0) | |
Returns an array of access IDs a user is permitted to see. More... | |
elgg_get_default_access (\ElggUser $user=null, array $input_params=[]) | |
Gets the default access permission. More... | |
elgg_has_access_to_entity (int $entity_guid, int $user_guid=0) | |
Can a user access an entity. More... | |
elgg_get_write_access_array (int $user_guid=0, bool $flush=false, array $input_params=[]) | |
Returns an array of access permissions that the user is allowed to save content with. More... | |
elgg_create_access_collection (string $name, int $owner_guid=0, string $subtype=null) | |
Creates a new access collection. More... | |
elgg_get_access_collection (int $collection_id) | |
Get a specified access collection. More... | |
elgg_get_access_collections (array $options=[]) | |
Returns access collections. More... | |
elgg_get_readable_access_level (int $entity_access_id) | |
Return the name of an ACCESS_* constant or an access collection, but only if the logged in user has write access to it. More... | |
elgg_create_access_collection | ( | string | $name, |
int | $owner_guid = 0 , |
||
string | $subtype = null |
||
) |
Creates a new access collection.
Access colletions allow plugins and users to create granular access for entities.
Triggers 'create', 'access_collection' event sequence
string | $name | The name of the collection |
int | $owner_guid | The GUID of the owner (default: currently logged in user) |
string | $subtype | The subtype indicates the usage of the acl |
Definition at line 147 of file access.php.
elgg_get_access_array | ( | int | $user_guid = 0 | ) |
Returns an array of access IDs a user is permitted to see.
Can be overridden with the 'access:collections:read', 'user' event.
This returns a list of all the collection ids a user owns or belongs to plus public and logged in access levels. If the user is an admin, it includes the private access level.
int | $user_guid | User ID; defaults to currently logged in user |
Definition at line 39 of file access.php.
elgg_get_access_collection | ( | int | $collection_id | ) |
Get a specified access collection.
int | $collection_id | The collection ID |
Definition at line 164 of file access.php.
elgg_get_access_collections | ( | array | $options = [] | ) |
Returns access collections.
array | $options | array of options to get access collections by |
Definition at line 175 of file access.php.
elgg_get_default_access | ( | \ElggUser | $user = null , |
array | $input_params = [] |
||
) |
Gets the default access permission.
This returns the default access level for the site or optionally of the user. If want you to change the default access based on group of other information, use the 'default', 'access' event.
\ElggUser | $user | The user for whom we're getting default access. Defaults to logged in user. |
array | $input_params | Parameters passed into an input/access view |
Definition at line 56 of file access.php.
elgg_get_ignore_access | ( | ) |
Functions for Elgg's access system for entities, metadata, and annotations.
Access is generally saved in the database as access_id. This corresponds to one of the ACCESS_* constants defined in elgglib.php or the ID of an access collection. Get current ignore access setting.
Definition at line 16 of file access.php.
elgg_get_readable_access_level | ( | int | $entity_access_id | ) |
Return the name of an ACCESS_* constant or an access collection, but only if the logged in user has write access to it.
Write access requirement prevents us from exposing names of access collections that current user has been added to by other members and may contain sensitive classification of the current user (e.g. close friends vs acquaintances).
Returns a string in the language of the user for global access levels, e.g.'Public, 'Friends', 'Logged in', 'Public'; or a name of the owned access collection, e.g. 'My work colleagues'; or a name of the group or other access collection, e.g. 'Group: Elgg technical support'; or 'Limited' if the user access is restricted to read-only, e.g. a friends collection the user was added to
int | $entity_access_id | The entity's access id |
Definition at line 196 of file access.php.
elgg_get_write_access_array | ( | int | $user_guid = 0 , |
bool | $flush = false , |
||
array | $input_params = [] |
||
) |
Returns an array of access permissions that the user is allowed to save content with.
Permissions returned are of the form (id => 'name').
Example return value in English: array( 0 => 'Private', -2 => 'Friends', 1 => 'Logged in users', 2 => 'Public', 34 => 'My favorite friends', );
Event of 'access:collections:write', 'user'
int | $user_guid | The user's GUID |
bool | $flush | If this is set to true, this will ignore a cached access array |
array | $input_params | Some parameters passed into an input/access view |
Definition at line 129 of file access.php.
elgg_has_access_to_entity | ( | int | $entity_guid, |
int | $user_guid = 0 |
||
) |
Can a user access an entity.
This is mostly useful for checking if a user other than the logged in user has access to an entity that is currently loaded.
int | $entity_guid | The entity_guid to check access for |
int | $user_guid | Optionally user_guid to check access with (defaults to logged in user) |
Definition at line 91 of file access.php.