diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-23 07:34:27 +0000 |
| commit | 28a09ed13e41ddbe5e30d63e92a1f5fb3395ef89 (patch) | |
| tree | 8281ccd48964ee0dd11c5ea689091fa3cef706fb /frontends/php/include/audit.inc.php | |
| parent | 495799b2aa61aab23d74d7faa110a0cd09d59bf0 (diff) | |
| download | zabbix-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/include/audit.inc.php')
| -rw-r--r-- | frontends/php/include/audit.inc.php | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/frontends/php/include/audit.inc.php b/frontends/php/include/audit.inc.php index b36b56de..6b89c53d 100644 --- a/frontends/php/include/audit.inc.php +++ b/frontends/php/include/audit.inc.php @@ -19,17 +19,52 @@ **/ ?> <?php + function audit_resource2str($resource_type) + { + $str_resource[AUDIT_RESOURCE_USER] = S_USER; + $str_resource[AUDIT_RESOURCE_ZABBIX_CONFIG] = S_CONFIGURATION_OF_ZABBIX; + $str_resource[AUDIT_RESOURCE_MEDIA_TYPE] = S_MEDIA_TYPE; + $str_resource[AUDIT_RESOURCE_HOST] = S_HOST; + $str_resource[AUDIT_RESOURCE_ACTION] = S_ACTION; + $str_resource[AUDIT_RESOURCE_GRAPH] = S_GRAPH; + $str_resource[AUDIT_RESOURCE_GRAPH_ELEMENT] = S_GRAPH_ELEMENT; + $str_resource[AUDIT_RESOURCE_USER_GROUP] = S_USER_GROUP; + $str_resource[AUDIT_RESOURCE_APPLICATION] = S_APPLICATION; + $str_resource[AUDIT_RESOURCE_TRIGGER] = S_TRIGGER; + $str_resource[AUDIT_RESOURCE_HOST_GROUP] = S_HOST_GROUP; + $str_resource[AUDIT_RESOURCE_ITEM] = S_ITEM; + $str_resource[AUDIT_RESOURCE_IMAGE] = S_IMAGE; + $str_resource[AUDIT_RESOURCE_VALUE_MAP] = S_VALUE_MAP; + $str_resource[AUDIT_RESOURCE_IT_SERVICE] = S_IT_SERVICE; + $str_resource[AUDIT_RESOURCE_MAP] = S_MAP; + $str_resource[AUDIT_RESOURCE_SCREEN] = S_SCREEN; + + if(isset($str_resource[$resource_type])) + return $str_resource[$resource_type]; + + return S_UNKNOWN_RESOURCE; + } + + function add_audit_if($condition,$action,$resourcetype,$details) + { + if($condition) + return add_audit($action,$resourcetype,$details); + + return false; + } + function add_audit($action,$resourcetype,$details) { global $USER_DETAILS; - $userid=$USER_DETAILS["userid"]; - $clock=time(); - $auditlogid = get_dbid("auditlog","auditlogid"); - $sql="insert into auditlog (auditlogid,userid,clock,action,resourcetype,details) values ($auditlogid,$userid,$clock,$action,$resourcetype,".zbx_dbstr($details).")"; - $result = DBexecute($sql); - if(!$result) - return $result; - return $auditlogid; + $auditid = get_dbid("auditlog","auditid"); + + if(($result = DBexecute("insert into auditlog (auditid,userid,clock,action,resourcetype,details) ". + " values ($auditid,".$USER_DETAILS["userid"].",".time().",$action,$resourcetype,".zbx_dbstr($details).")"))) + { + $result = $auditid; + } + + return $result; } ?> |
