Elgg\Database\AccessCollections::getAccessList PHP Method

getAccessList() public method

Return a string of access_ids for $user_guid appropriate for inserting into an SQL IN clause.
See also: get_access_array()
public getAccessList ( integer $user_guid, boolean $flush = false ) : string
$user_guid integer User ID; defaults to currently logged in user
$flush boolean If set to true, will refresh the access list from the database rather than using this function's cache.
return string A list of access collections suitable for using in an SQL call
    function getAccessList($user_guid = 0, $flush = false)
    {
        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_access_list';
        if ($cache[$hash]) {
            return $cache[$hash];
        }
        $access_array = $this->getAccessArray($user_guid, $flush);
        $access = "(" . implode(",", $access_array) . ")";
        if ($init_finished) {
            $cache[$hash] = $access;
        }
        return $access;
    }