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);
}