function _user_is_in_viewing_group() { if ($group =& $this->_get_group('form_to_authorized_viewing_group')) { $netid = $this->get_user_netid(); $gh = new group_helper(); $gh->set_group_by_entity($group); return $gh->has_authorization($netid); } else return true; }
/** * Determine if a given user has access to all of a set of assets * * @param array $access * @param string $username * @return boolean */ function _has_access($assets, $username) { if (!is_array($assets)) { $assets = array($assets->id() => $assets); } if (!empty($assets)) { $es = new entity_selector(); $es->add_right_relationship(array_keys($assets), relationship_id_of('asset_access_permissions_to_group')); $es->add_type(id_of('group_type')); $es->set_env('site', $this->site_id); $groups = $es->run_one(); //pray($groups); //die(); foreach ($groups as $group_id => $group) { $gh = new group_helper(); $gh->set_group_by_entity($group); if (!$gh->has_authorization($username)) { return false; } } } return true; }