diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 4896ce0bc4..520c2dca1f 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -205,6 +205,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => true, ), + 'log_usage' => array( + 'type' => 'bool', + 'description' => 'Log the usage of the application (i.e. the date/time and the user name of each login)', + 'default' => false, + 'value' => false, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), ); public function IsProperty($sPropCode) @@ -333,7 +341,7 @@ class Config 'application/menunode.class.inc.php', 'application/user.preferences.class.inc.php', 'application/audit.rule.class.inc.php', -// Romain - That's dirty, because those 3 classes are in fact part of the core +// Romain - That's dirty, because those classes are in fact part of the core // but I needed those classes to be derived from cmdbAbstractObject // (to be managed via the GUI) and this class in not really known from // the core, PLUS I needed the includes to be there also for the setup diff --git a/core/event.class.inc.php b/core/event.class.inc.php index f49ef6bcea..6aa58b314a 100644 --- a/core/event.class.inc.php +++ b/core/event.class.inc.php @@ -258,4 +258,35 @@ class EventWebService extends Event } } +class EventLoginUsage extends Event +{ + public static function Init() + { + $aParams = array + ( + "category" => "core/cmdb,view_in_gui", + "key_type" => "autoincrement", + "name_attcode" => "", + "state_attcode" => "", + "reconc_keys" => array(), + "db_table" => "priv_event_loginusage", + "db_key_field" => "id", + "db_finalclass_field" => "", + ); + MetaModel::Init_Params($aParams); + MetaModel::Init_InheritAttributes(); + + MetaModel::Init_AddAttribute(new AttributeExternalKey("user_id", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"user_id", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalField("contact_name", array("allowed_values"=>null, "extkey_attcode"=>"user_id", "target_attcode"=>"contactid", "is_null_allowed"=>true, "depends_on"=>array()))); + MetaModel::Init_AddAttribute(new AttributeExternalField("contact_email", array("allowed_values"=>null, "extkey_attcode"=>"user_id", "target_attcode"=>"email", "is_null_allowed"=>true, "depends_on"=>array()))); + + // Display lists + MetaModel::Init_SetZListItems('details', array('date', 'user_id', 'contact_name', 'contact_email', 'userinfo', 'message')); // Attributes to be displayed for the complete details + MetaModel::Init_SetZListItems('list', array('date', 'user_id', 'contact_name', 'contact_email', 'userinfo')); // Attributes to be displayed for a list + // Search criteria + MetaModel::Init_SetZListItems('standard_search', array('date', 'user_id', 'contact_name', 'contact_email')); // Criteria of the std search form +// MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form + } +} + ?>