summaryrefslogtreecommitdiffstats
path: root/frontends/php/sysmaps.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-23 07:34:27 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-10-23 07:34:27 +0000
commit28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (patch)
tree8281ccd48964ee0dd11c5ea689091fa3cef706fb /frontends/php/sysmaps.php
parent495799b2aa61aab23d74d7faa110a0cd09d59bf0 (diff)
downloadzabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.gz
zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.tar.xz
zabbix-28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89.zip
- developed group permission system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3371 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/sysmaps.php')
-rw-r--r--frontends/php/sysmaps.php97
1 files changed, 46 insertions, 51 deletions
diff --git a/frontends/php/sysmaps.php b/frontends/php/sysmaps.php
index c7f54221..684fc389 100644
--- a/frontends/php/sysmaps.php
+++ b/frontends/php/sysmaps.php
@@ -19,71 +19,69 @@
**/
?>
<?php
- include "include/config.inc.php";
- include "include/forms.inc.php";
+ require_once "include/config.inc.php";
+ require_once "include/maps.inc.php";
+ require_once "include/forms.inc.php";
+
$page["title"] = "S_NETWORK_MAPS";
$page["file"] = "sysmaps.php";
- show_header($page["title"],0,0);
- insert_confirm_javascript();
-?>
-<?php
- if(!check_anyright("Network map","U"))
- {
- show_table_header("<font color=\"AA0000\">No permissions !</font>");
- show_page_footer();
- exit;
- }
- update_profile("web.menu.config.last",$page["file"]);
-?>
+include_once "include/page_header.php";
+ insert_confirm_javascript();
+?>
<?php
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
"sysmapid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,NULL),
- "name"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,"isset({save})"),
- "width"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535),"isset({save})"),
- "height"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535),"isset({save})"),
- "background"=> array(T_ZBX_STR, O_OPT, NULL, NULL,"isset({save})"),
- "label_type"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,4),"isset({save})"),
- "label_location"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,3),"isset({save})"),
+ "name"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, "isset({save})"),
+ "width"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535), "isset({save})"),
+ "height"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,65535), "isset({save})"),
+ "backgroundid"=> array(T_ZBX_INT, O_OPT, NULL, DB_ID, "isset({save})"),
+ "label_type"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,4), "isset({save})"),
+ "label_location"=> array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0,3), "isset({save})"),
+/* Actions */
"save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
"delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
"cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
+
+/* Form */
"form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
"form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL)
-// "triggerid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID,'{form}=="update"'),
-
-// "description"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({save})'),
-// "expression"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({save})'),
-// "priority"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1,2,3,4,5"),'isset({save})'),
-// "comments"=> array(T_ZBX_STR, O_OPT, NULL, NULL,'isset({save})'),
-// "url"=> array(T_ZBX_STR, O_OPT, NULL, NULL,'isset({save})'),
-// "disabled"=> array(T_ZBX_STR, O_OPT, NULL, NULL,NULL)
);
check_fields($fields);
+
+ if(isset($_REQUEST["sysmapid"]))
+ {
+ if(!sysmap_accessiable($_REQUEST["sysmapid"],PERM_READ_WRITE))
+ access_deny();
+
+ $sysmap = DBfetch(DBselect("select * from sysmaps where sysmapid=".$_REQUEST["sysmapid"]));
+ }
?>
-
-
-
-
<?php
if(isset($_REQUEST["save"]))
{
if(isset($_REQUEST["sysmapid"]))
{
+ // TODO check permission by new value.
$result=update_sysmap($_REQUEST["sysmapid"],$_REQUEST["name"],$_REQUEST["width"],
- $_REQUEST["height"],$_REQUEST["background"],$_REQUEST["label_type"],
+ $_REQUEST["height"],$_REQUEST["backgroundid"],$_REQUEST["label_type"],
$_REQUEST["label_location"]);
+ add_audit_if($result,AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_MAP,'Name ['.$_REQUEST['name'].']');
show_messages($result,"Network map updated","Cannot update network map");
} else {
+ if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_MODE_LT,PERM_RES_IDS_ARRAY,$ZBX_CURNODEID)))
+ access_deny();
+
$result=add_sysmap($_REQUEST["name"],$_REQUEST["width"],$_REQUEST["height"],
- $_REQUEST["background"],$_REQUEST["label_type"],$_REQUEST["label_location"]);
+ $_REQUEST["backgroundid"],$_REQUEST["label_type"],$_REQUEST["label_location"]);
+ add_audit_if($result,AUDIT_ACTION_ADD,AUDIT_RESOURCE_MAP,'Name ['.$_REQUEST['name'].']');
show_messages($result,"Network map added","Cannot add network map");
}
if($result){
@@ -92,21 +90,20 @@
}
elseif(isset($_REQUEST["delete"])&&isset($_REQUEST["sysmapid"]))
{
- $result=delete_sysmap($_REQUEST["sysmapid"]);
+ $result = delete_sysmap($_REQUEST["sysmapid"]);
+ add_audit_if($result,AUDIT_ACTION_DELETE,AUDIT_RESOURCE_MAP,'Name ['.$sysmap['name'].']');
show_messages($result,"Network map deleted","Cannot delete network map");
if($result){
unset($_REQUEST["form"]);
}
}
?>
-
<?php
$form = new CForm();
$form->AddItem(new CButton("form",S_CREATE_MAP));
- show_header2(S_CONFIGURATION_OF_NETWORK_MAPS, $form);
+ show_table_header(S_CONFIGURATION_OF_NETWORK_MAPS, $form);
echo BR;
?>
-
<?php
if(isset($_REQUEST["form"]))
{
@@ -114,20 +111,17 @@
}
else
{
- show_header2(S_MAPS_BIG);
+ show_table_header(S_MAPS_BIG);
$table = new CTableInfo(S_NO_MAPS_DEFINED);
- $table->setHeader(array(S_ID,S_NAME,S_WIDTH,S_HEIGHT,S_MAP));
+ $table->SetHeader(array(S_NAME,S_WIDTH,S_HEIGHT,S_MAP));
- $result=DBselect("select sysmapid,name,width,height from sysmaps where mod(sysmapid,100)=$ZBX_CURNODEID order by name");
+ $result = DBselect("select sysmapid,name,width,height from sysmaps ".
+ " where ".DBid2nodeid("sysmapid")."=".$ZBX_CURNODEID." order by name");
while($row=DBfetch($result))
{
- if(!check_right("Network map","U",$row["sysmapid"]))
- {
- continue;
- }
-
- $table->addRow(array(
- $row["sysmapid"],
+ if(!sysmap_accessiable($row["sysmapid"],PERM_READ_WRITE)) continue;
+
+ $table->AddRow(array(
new CLink($row["name"], "sysmaps.php?form=update".
"&sysmapid=".$row["sysmapid"]."#form",'action'),
$row["width"],
@@ -135,10 +129,11 @@
new CLink(S_EDIT,"sysmap.php?sysmapid=".$row["sysmapid"])
));
}
- $table->show();
+ $table->Show();
}
?>
-
<?php
- show_page_footer();
+
+include_once "include/page_footer.php";
+
?>