Elgg
Version 6.0
|
Access collections database service. More...
Public Member Functions | |
__construct (Config $config, Database $db, EntityTable $entities, UserCapabilities $capabilities, BaseCache $cache, EventsService $events, SessionManagerService $session_manager, Translator $translator) | |
Constructor. More... | |
markInitComplete () | |
Mark the access system as initialized. More... | |
getAccessArray (int $user_guid=0, bool $flush=false) | |
Returns an array of access IDs a user is permitted to see. More... | |
hasAccessToEntity (\ElggEntity $entity, int $user_guid=0) | |
Can a user access an entity. More... | |
getWriteAccessArray (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... | |
canEdit (int $collection_id, int $user_guid=null) | |
Can the user change this access collection? More... | |
create (\ElggAccessCollection $acl) | |
Creates a new access collection. More... | |
update (\ElggAccessCollection $acl) | |
Update an existing access collection. More... | |
delete (\ElggAccessCollection $acl) | |
Deletes a collection and its membership information. More... | |
rowToElggAccessCollection (\stdClass $row) | |
Transforms a database row to an instance of ElggAccessCollection. More... | |
get (int $collection_id) | |
Get a specified access collection. More... | |
hasUser (int $user_guid, int $collection_id) | |
Check if user is already in the collection. More... | |
addUser (int $user_guid, int $collection_id) | |
Adds a user to an access collection. More... | |
removeUser (int $user_guid, int $collection_id) | |
Removes a user from an access collection. More... | |
getEntityCollections (array $options=[]) | |
Returns access collections. More... | |
getMembers (int $collection_id, array $options=[]) | |
Get members of an access collection. More... | |
getCollectionsByMember (int $member_guid) | |
Return an array of collections that the entity is member of. More... | |
getReadableAccessLevel (int $entity_access_id) | |
Return the name of an ACCESS_* constant or an access collection, but only if the logged in user owns the access collection or is an admin. More... | |
Public Attributes | |
const | TABLE_NAME = 'access_collections' |
const | MEMBERSHIP_TABLE_NAME = 'access_collection_membership' |
Protected Member Functions | |
getCollectionsForWriteAccess (int $owner_guid) | |
Returns an array of access collections to be used in the write access array. More... | |
Protected Attributes | |
Config | $config |
Database | $db |
BaseCache | $access_cache |
EventsService | $events |
SessionManagerService | $session_manager |
EntityTable | $entities |
UserCapabilities | $capabilities |
Translator | $translator |
bool | $init_complete = false |
Access collections database service.
Definition at line 23 of file AccessCollections.php.
Elgg\Database\AccessCollections::__construct | ( | Config | $config, |
Database | $db, | ||
EntityTable | $entities, | ||
UserCapabilities | $capabilities, | ||
BaseCache | $cache, | ||
EventsService | $events, | ||
SessionManagerService | $session_manager, | ||
Translator | $translator | ||
) |
Constructor.
Config | $config | Config |
Database | $db | Database |
EntityTable | $entities | Entity table |
UserCapabilities | $capabilities | User capabilities |
BaseCache | $cache | Access cache |
EventsService | $events | Events |
SessionManagerService | $session_manager | Session |
Translator | $translator | Translator |
Definition at line 67 of file AccessCollections.php.
Elgg\Database\AccessCollections::addUser | ( | int | $user_guid, |
int | $collection_id | ||
) |
Adds a user to an access collection.
Triggers the 'access:collections:add_user', 'collection' event.
int | $user_guid | GUID of the user to add |
int | $collection_id | ID of the collection to add them to |
Definition at line 530 of file AccessCollections.php.
Elgg\Database\AccessCollections::canEdit | ( | int | $collection_id, |
int | $user_guid = null |
||
) |
Can the user change this access collection?
Use the event of 'access:collections:write', 'user' to change this.
Respects access control disabling for admin users and elgg_call()
int | $collection_id | The collection id |
int | $user_guid | The user GUID to check for. Defaults to logged in user. |
Definition at line 351 of file AccessCollections.php.
Elgg\Database\AccessCollections::create | ( | \ElggAccessCollection | $acl | ) |
Creates a new access collection.
Access colletions allow plugins and users to create granular access for entities.
Triggers event sequence 'create', 'access_collection'
Definition at line 390 of file AccessCollections.php.
Elgg\Database\AccessCollections::delete | ( | \ElggAccessCollection | $acl | ) |
Deletes a collection and its membership information.
\ElggAccessCollection | $acl | the access collection to update |
Definition at line 452 of file AccessCollections.php.
Elgg\Database\AccessCollections::get | ( | int | $collection_id | ) |
Get a specified access collection.
int | $collection_id | The collection ID |
Definition at line 496 of file AccessCollections.php.
Elgg\Database\AccessCollections::getAccessArray | ( | int | $user_guid = 0 , |
bool | $flush = false |
||
) |
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.
Definition at line 119 of file AccessCollections.php.
Elgg\Database\AccessCollections::getCollectionsByMember | ( | int | $member_guid | ) |
Return an array of collections that the entity is member of.
int | $member_guid | GUID of th member |
Definition at line 666 of file AccessCollections.php.
|
protected |
Returns an array of access collections to be used in the write access array.
int | $owner_guid | owner of the collections |
Definition at line 308 of file AccessCollections.php.
Elgg\Database\AccessCollections::getEntityCollections | ( | array | $options = [] | ) |
Returns access collections.
array | $options | Options to get access collections by Supported are 'owner_guid', 'subtype' |
Definition at line 615 of file AccessCollections.php.
Elgg\Database\AccessCollections::getMembers | ( | int | $collection_id, |
array | $options = [] |
||
) |
Get members of an access collection.
int | $collection_id | The collection's ID |
array | $options | Ege* options |
Definition at line 649 of file AccessCollections.php.
Elgg\Database\AccessCollections::getReadableAccessLevel | ( | int | $entity_access_id | ) |
Return the name of an ACCESS_* constant or an access collection, but only if the logged in user owns the access collection or is an admin.
Ownership 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', 'Private'; 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 694 of file AccessCollections.php.
Elgg\Database\AccessCollections::getWriteAccessArray | ( | 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', );
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 249 of file AccessCollections.php.
Elgg\Database\AccessCollections::hasAccessToEntity | ( | \ElggEntity | $entity, |
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.
\ElggEntity | $entity | The entity to check access for |
int | $user_guid | Optionally user_guid to check access for. Defaults to logged in user |
Definition at line 194 of file AccessCollections.php.
Elgg\Database\AccessCollections::hasUser | ( | int | $user_guid, |
int | $collection_id | ||
) |
Check if user is already in the collection.
int | $user_guid | GUID of the user |
int | $collection_id | ID of the collection |
Definition at line 512 of file AccessCollections.php.
Elgg\Database\AccessCollections::markInitComplete | ( | ) |
Mark the access system as initialized.
Definition at line 91 of file AccessCollections.php.
Elgg\Database\AccessCollections::removeUser | ( | int | $user_guid, |
int | $collection_id | ||
) |
Removes a user from an access collection.
Triggers the 'access:collections:remove_user', 'collection' event.
int | $user_guid | GUID of the user |
int | $collection_id | ID of the collection |
Definition at line 586 of file AccessCollections.php.
Elgg\Database\AccessCollections::rowToElggAccessCollection | ( | \stdClass | $row | ) |
Transforms a database row to an instance of ElggAccessCollection.
\stdClass | $row | Database row |
Definition at line 485 of file AccessCollections.php.
Elgg\Database\AccessCollections::update | ( | \ElggAccessCollection | $acl | ) |
Update an existing access collection.
\ElggAccessCollection | $acl | the access collection to update |
Definition at line 423 of file AccessCollections.php.
|
protected |
Definition at line 41 of file AccessCollections.php.
|
protected |
Definition at line 49 of file AccessCollections.php.
|
protected |
Definition at line 37 of file AccessCollections.php.
|
protected |
Definition at line 39 of file AccessCollections.php.
|
protected |
Definition at line 47 of file AccessCollections.php.
|
protected |
Definition at line 43 of file AccessCollections.php.
|
protected |
Definition at line 53 of file AccessCollections.php.
|
protected |
Definition at line 45 of file AccessCollections.php.
|
protected |
Definition at line 51 of file AccessCollections.php.
const Elgg\Database\AccessCollections::MEMBERSHIP_TABLE_NAME = 'access_collection_membership' |
Definition at line 35 of file AccessCollections.php.
const Elgg\Database\AccessCollections::TABLE_NAME = 'access_collections' |
Definition at line 30 of file AccessCollections.php.