本文整理汇总了PHP中Acl::get_user_entities方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::get_user_entities方法的具体用法?PHP Acl::get_user_entities怎么用?PHP Acl::get_user_entities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::get_user_entities方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select_profile
function select_profile()
{
global $sid, $username, $dbconn, $version, $nessus_path;
$used_sids = array();
if (preg_match("/omp\\s*\$/i", $nessus_path)) {
$omp = new OMP();
$used_sids = $omp->get_used_sids();
}
$entities_nt = array();
$query = "SELECT ae.id as eid, ae.name as ename, aet.name as etype FROM acl_entities AS ae, acl_entities_types AS aet WHERE ae.type = aet.id";
$result_entities = $dbconn->Execute($query);
while (!$result_entities->EOF) {
$entities_nt[$result_entities->fields['eid']] = $result_entities->fields['ename'] . " [" . $result_entities->fields['etype'] . "]";
$result_entities->MoveNext();
}
$query = "";
$normal_user_pro = false;
if ($username == "admin") {
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings \n WHERE deleted != '1' ORDER BY name";
} else {
if (preg_match("/pro|demo/i", $version)) {
if (Acl::am_i_proadmin()) {
$pro_users = array();
$entities_list = array();
//list($entities_admin,$num) = Acl::get_entities_admin($dbconn,Session::get_session_user());
//$entities_list = array_keys($entities_admin);
$entities_list = Acl::get_user_entities($current_user);
$users = Acl::get_my_users($dbconn, Session::get_session_user());
foreach ($users as $us) {
$pro_users[] = $us["login"];
}
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings \n WHERE deleted != '1' and (name='Default' or owner in ('0','" . implode("', '", array_merge($entities_list, $pro_users)) . "')) ORDER BY name";
} else {
$tmp = array();
$entities = Acl::get_user_entities($username);
foreach ($entities as $entity) {
$tmp[] = "'" . $entity . "'";
}
if (count($tmp) > 0) {
$user_where = "owner in ('0','{$username}'," . implode(", ", $tmp) . ")";
} else {
$user_where = "owner in ('0','{$username}')";
}
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings \n WHERE deleted != '1' and (name='Default' or {$user_where}) ORDER BY name";
$normal_user_pro = true;
}
} else {
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings \n WHERE deleted != '1' and (name='Default' or owner in ('0','{$username}')) ORDER BY name";
}
}
//var_dump($query);
$result = $dbconn->execute($query);
//echo $query;
echo "<CENTER>";
echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"800\"><tr><td class=\"headerpr\" style=\"border:0;\">" . _("Vulnerability Scan Profiles") . "</td></tr></table>";
echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"800\"><tr><td class=\"noborder\">";
echo "<p>";
echo _("Please select a profile to edit") . ":";
echo "</p>";
echo "<table align='center'>";
echo "<tr>";
if ($username == "admin" || Session::am_i_admin()) {
echo "<th>" . _("Available for") . "</th>";
}
echo " <th>" . _("Profile") . "</th>";
echo " <th>" . _("Description") . "</th>";
echo " <th>" . _("Action") . "</th>";
echo "</tr>";
while (!$result->EOF) {
//<td>$sowner</td>
//<td>$stype</td>
list($sid, $sname, $sdescription, $sowner, $stype) = $result->fields;
echo "<tr>";
if ($username == "admin" || Session::am_i_admin()) {
if ($sowner == "0") {
echo "<td>" . _("All") . "</td>";
} elseif (is_numeric($sowner)) {
echo "<td style='padding:0px 2px 0px 2px;'>" . $entities_nt[$sowner] . "</td>";
} else {
echo "<td>" . html_entity_decode($sowner) . "</td>";
}
}
echo "<td>" . html_entity_decode($sname) . "</td>";
echo "<td>" . html_entity_decode($sdescription) . "</td>";
echo "<td>";
//var_dump($normal_user_pro);
//var_dump($sowner);
//var_dump($username);
//var_dump($used_sids);
if ($normal_user_pro && $sowner != $username && $sname != "Default") {
echo " ";
} elseif ($username == "admin" || Session::am_i_admin()) {
if (!in_array($sid, $used_sids)) {
echo "<a href=\"settings.php?disp=edit&&sid={$sid}\"><img src=\"images/pencil.png\"></a>";
echo "<a href=\"settings.php?disp=edit&op=delete&sid={$sid}\" onclick=\"return confirmDelete();\"><img src=\"images/delete.gif\"></a>";
} else {
echo "<img src=\"images/pencil.png\" title=\"" . _("This profile is being used by a running job now") . "\" style=\"filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;\">";
echo "<img src=\"images/delete.gif\" title=\"" . _("This profile is being used by a running job now") . "\" style=\"filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;\">";
}
} elseif ($sname == "Default") {
//.........这里部分代码省略.........
示例2: in
$query = "DELETE FROM vuln_nessus_latest_results WHERE report_id in (" . $_SESSION["_dreport_ids"] . ")";
$result = $dbconn->execute($query);
unset($_SESSION["_dreport_ids"]);
}
$conf = $GLOBALS["CONF"];
$version = $conf->get_conf("ossim_server_version", FALSE);
$arruser = array();
if (!preg_match("/pro|demo/i", $version)) {
$user = Session::get_session_user();
$arruser[] = $user;
if (Session::get_session_user() != ACL_DEFAULT_OSSIM_ADMIN && Session::am_i_admin()) {
$arruser[] = ACL_DEFAULT_OSSIM_ADMIN;
}
} else {
$entities = array();
$entities = Acl::get_user_entities();
$entities[] = Session::get_session_user();
// add current user
if (Session::get_session_user() != ACL_DEFAULT_OSSIM_ADMIN && Session::am_i_admin()) {
$entities[] = ACL_DEFAULT_OSSIM_ADMIN;
}
$arruser = $entities;
$user = implode("', '", $entities);
}
if ($delete != "") {
$query = "SELECT report_id, sid, username FROM vuln_nessus_latest_reports WHERE report_key='{$delete}' and scantime='{$scantime}'";
$result = $dbconn->execute($query);
$dreport_id = $result->fields["report_id"];
$dsid = $result->fields["sid"];
$dusername = $result->fields["username"];
$query = "DELETE FROM vuln_nessus_latest_reports WHERE report_key='{$delete}' and scantime='{$scantime}'";
示例3: tab_discovery
//.........这里部分代码省略.........
if (Session::am_i_admin() || Session::sensorAllowed($shostIP)) {
// $shostIP=="localhost" ||
$discovery .= "<option value=\"{$SVRid}\" ";
if ($editdata['scan_ASSIGNED'] != "" && $editdata['scan_ASSIGNED'] == $SVRid) {
$discovery .= " SELECTED";
}
if ($SVRid_selected == $SVRid) {
$discovery .= " SELECTED";
}
$discovery .= ">" . strtoupper($sname) . " [{$shostIP}] </option>";
}
$result->MoveNext();
}
$discovery .= <<<EOT
</select>
</td>
</tr>
<tr>
EOT;
$discovery .= "<td align='right' width='25%'>" . _("Profile") . ":</td>";
$discovery .= "<td style='text-align:left;'><select name='sid'>";
//$query = "SELECT distinct(t1.id), t1.name, t1.description
// FROM vuln_nessus_settings t1
// LEFT JOIN vuln_nessus_settings_users t2 ON t1.id = t2.sid
// WHERE t1.type = 'G' OR t2.username='$username'
// ORDER BY t1.name";
$query = "";
if ($username == "admin" || Session::am_i_admin()) {
$query = "SELECT distinct(t1.id), t1.name, t1.description \n FROM vuln_nessus_settings t1 WHERE deleted='0'\n ORDER BY t1.name";
} else {
if (preg_match("/pro|demo/i", $version)) {
if (Acl::am_i_proadmin()) {
$pro_users = array();
$entities_list = Acl::get_user_entities($current_user);
//list($entities_admin,$num) = Acl::get_entities_admin($dbconn,Session::get_session_user());
//$entities_list = array_keys($entities_admin);
$users = Acl::get_my_users($dbconn, Session::get_session_user());
foreach ($users as $us) {
$pro_users[] = $us["login"];
}
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or owner in ('0','" . implode("','", array_merge($entities_list, $pro_users)) . "')) ORDER BY t1.name";
} else {
$tmp = array();
$entities = Acl::get_user_entities($username);
foreach ($entities as $entity) {
$tmp[] = "'" . $entity . "'";
}
if (count($tmp) > 0) {
$user_where = "owner in ('0','{$username}'," . implode(", ", $tmp) . ")";
} else {
$user_where = "owner in ('0','{$username}')";
}
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or {$user_where}) ORDER BY t1.name";
}
} else {
$query = "SELECT distinct(t1.id), t1.name, t1.description FROM vuln_nessus_settings t1\n WHERE deleted = '0' and (name='Default' or owner in ('0','{$username}')) ORDER BY t1.name";
}
}
//var_dump($query);
$result = $dbconn->execute($query);
$job_profiles = array();
$id_found = false;
$ipr = 0;
while (!$result->EOF) {
list($sid, $sname, $sdescription) = $result->fields;
if ($sid_selected == $sid) {
示例4: showSubCategoryHTML
function showSubCategoryHTML()
{
// get list reports
$db = new ossim_db();
$dbconn = $db->connect();
$creports = array();
$subreports_ac = array();
$sql_search = "";
if ($search != "") {
$sql_search = "AND name like '%{$search}%'";
}
$result = $dbconn->Execute("SELECT login, name, value FROM user_config where category='custom_report' {$sql_search} ORDER BY name ASC");
$hi = 0;
while (!$result->EOF) {
$available = false;
$unserializedata = unserialize($result->fields["value"]);
$available_for_user = $unserializedata["user"];
$available_for_entity = $unserializedata["entity"];
// check if this report is available for session user
if (Session::am_i_admin()) {
$available = true;
} else {
if ($available_for_user == "0") {
$available = true;
} else {
if ($available_for_user != "" && $available_for_user == $session_user || $result->fields["login"] == $session_user) {
$available = true;
} else {
if (preg_match("/pro|demo/i", $version)) {
if (Acl::am_i_proadmin()) {
$entities_list = Acl::get_entities_admin($dbconn, Session::get_session_user());
$entities = array_keys($entities_list[0]);
$users = Acl::get_my_users($dbconn, Session::get_session_user());
$users_login = array();
foreach ($users as $user) {
$users_login[] = $user["login"];
}
if (in_array($available_for_entity, $entities) || in_array($available_for_user, $users_login) || in_array($result->fields["login"], $users_login)) {
$available = true;
}
} else {
$entities = Acl::get_user_entities(Session::get_session_user());
if (in_array($available_for_entity, $entities)) {
$available = true;
}
}
}
}
}
}
// save report if is available
$maxpag = 20;
$to = $pag * $maxpag;
$from = $to - $maxpag;
if ($available) {
if ($from <= $hi && $hi < $to) {
$creports[] = $result->fields;
}
// autocomplete
$key = base64_encode($result->fields["name"] . "###" . $result->fields["login"]);
$subreports_ac[$key] = trim($result->fields["name"]);
$hi++;
}
$result->MoveNext();
}
$dbconn->disconnect();
//
$html = '<table style="margin:0;padding:0;width:100%;font-size:11px">
<tr>
<td colspan="2">' . _('Properties report') . ':</td>
</tr>
<tr>
<td>' . _('Report Name') . ':</td>
<td>
<select name="run">';
foreach ($subreports_ac as $key => $value) {
$html .= '<option value="' . $key . '"';
$html .= $this->get('run') == $key ? ' selected="selected"' : "";
$html .= '>' . $value . '</option>';
}
$html .= ' </select>
</td>
</tr>
<tr>
<td>' . _('Refresh report') . ':</td>
<td><input name="refresh" value="false" ';
if ($this->get('refresh') == 'false') {
$html .= 'checked="checked" ';
}
$html .= 'type="radio">' . _('No') . '
<input name="refresh" value="true" ';
if ($this->get('refresh') == 'true') {
$html .= 'checked="checked" ';
}
$html .= 'type="radio">' . _('Yes') . '
<input style="width:80px" type="text" name="secondRefresh" value="' . $this->get('secondRefresh') . '" /> ' . _('seconds') . '</td>
</tr>
</table>';
return $html;
}
示例5: die
if (ossim_error()) {
die(ossim_error());
}
$db = new ossim_db();
$dbconn = $db->connect();
$conf = $GLOBALS["CONF"];
$version = $conf->get_conf("ossim_server_version", FALSE);
// check username
$user = "";
$user_name_filter = "";
if (!Session::am_i_admin()) {
if (!preg_match("/pro|demo/i", $version)) {
$user = Session::get_session_user();
} else {
$entities_and_users = array();
$entities_and_users = Acl::get_user_entities();
$entities_and_users[] = Session::get_session_user();
// add current user
$users_pro_admin = Acl::get_my_users($dbconn, Session::get_session_user());
foreach ($users_pro_admin as $us) {
$entities_and_users[] = $us["login"];
}
$user = implode("', '", $entities_and_users);
}
}
if ($user != "") {
$user_name_filter = "and username in ('{$user}')";
}
$result = $dbconn->Execute("select name, scan_PID from vuln_jobs where id={$job_id} {$user_name_filter}");
$name = "";
$name = $result->fields["name"];