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

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

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', ); Plugin hook of 'access:collections:write', 'user'
public getWriteAccessArray ( integer $user_guid, boolean $flush = false, array $input_params = [] ) : array
$user_guid integer The user's GUID.
$flush boolean If this is set to true, this will ignore a cached access array
$input_params array Some parameters passed into an input/access view
Результат array List of access permissions
    function getWriteAccessArray($user_guid = 0, $flush = false, array $input_params = array())
    {
        global $init_finished;
        $cache = $this->access_cache;
        if ($flush) {
            $cache->clear();
        }
        if ($user_guid == 0) {
            $user_guid = $this->session->getLoggedInUserGuid();
        }
        $user_guid = (int) $user_guid;
        $hash = $user_guid . 'get_write_access_array';
        if ($cache[$hash]) {
            $access_array = $cache[$hash];
        } else {
            // @todo is there such a thing as public write access?
            $access_array = array(ACCESS_PRIVATE => $this->getReadableAccessLevel(ACCESS_PRIVATE), ACCESS_LOGGED_IN => $this->getReadableAccessLevel(ACCESS_LOGGED_IN), ACCESS_PUBLIC => $this->getReadableAccessLevel(ACCESS_PUBLIC));
            $collections = $this->getEntityCollections($user_guid);
            if ($collections) {
                foreach ($collections as $collection) {
                    $access_array[$collection->id] = $collection->name;
                }
            }
            if ($init_finished) {
                $cache[$hash] = $access_array;
            }
        }
        $options = array('user_id' => $user_guid, 'input_params' => $input_params);
        return $this->hooks->trigger('access:collections:write', 'user', $options, $access_array);
    }