Elgg\Database\AccessCollections::canEdit PHP Метод

canEdit() публичный Метод

Use the plugin hook of 'access:collections:write', 'user' to change this.
См. также: get_write_access_array() for details on the hook. Respects access control disabling for admin users and {@link elgg_set_ignore_access()}
См. также: get_write_access_array()
public canEdit ( integer $collection_id, mixed $user_guid = null ) : boolean
$collection_id integer The collection id
$user_guid mixed The user GUID to check for. Defaults to logged in user.
Результат boolean
    function canEdit($collection_id, $user_guid = null)
    {
        try {
            $user = $this->entities->getUserForPermissionsCheck($user_guid);
        } catch (UserFetchFailureException $e) {
            return false;
        }
        $collection = $this->get($collection_id);
        if (!$user || !$collection) {
            return false;
        }
        $write_access = $this->getWriteAccessArray($user->guid, true);
        // don't ignore access when checking users.
        if ($user_guid) {
            return array_key_exists($collection_id, $write_access);
        } else {
            return elgg_get_ignore_access() || array_key_exists($collection_id, $write_access);
        }
    }