File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,14 +42,30 @@ class FireGento_AdminMonitoring_Helper_Data extends Mage_Core_Helper_Abstract
4242 const ACTION_INSERT = 1 ;
4343 const ACTION_UPDATE = 2 ;
4444 const ACTION_DELETE = 3 ;
45- const ACTION_LOGIN = 4 ;
45+ const ACTION_LOGIN = 4 ;
4646
4747 /**
4848 * STATUS
4949 */
5050 const STATUS_SUCCESS = 1 ;
5151 const STATUS_FAILURE = 2 ;
5252
53+ /**
54+ * Checks if the given admin user id is excluded
55+ *
56+ * @param int $userId User ID
57+ * @return bool
58+ */
59+ public function isAdminUserIdExcluded ($ userId )
60+ {
61+ $ excludedUserIds = explode (', ' , Mage::getStoreConfig ('admin/firegento_adminmonitoring/exclude_admin_users ' ));
62+ if (in_array ($ userId , $ excludedUserIds )) {
63+ return true ;
64+ }
65+
66+ return false ;
67+ }
68+
5369 /**
5470 * Retrieve the attribute type by provided class name
5571 *
@@ -113,7 +129,7 @@ public function getRowUrl(FireGento_AdminMonitoring_Model_History $row)
113129 * @param string $separator Separator
114130 * @return string
115131 */
116- public function getFullActionName ($ separator= '_ ' )
132+ public function getFullActionName ($ separator = '_ ' )
117133 {
118134 $ request = array (
119135 Mage::app ()->getRequest ()->getModuleName (),
Original file line number Diff line number Diff line change 3636 */
3737class FireGento_AdminMonitoring_Model_History extends Mage_Core_Model_Abstract
3838{
39+ /**
40+ * @var bool
41+ */
42+ protected $ _forcedLogging = false ;
43+
3944 /**
4045 * Inits the resource model and resource collection model
4146 */
@@ -44,6 +49,35 @@ protected function _construct()
4449 $ this ->_init ('firegento_adminmonitoring/history ' );
4550 }
4651
52+ /**
53+ * Processing object before save data
54+ *
55+ * @return FireGento_AdminMonitoring_Model_History
56+ */
57+ protected function _beforeSave ()
58+ {
59+ if (Mage::helper ('firegento_adminmonitoring ' )->isAdminUserIdExcluded ($ this ->getData ('user_id ' ))
60+ && !$ this ->_forcedLogging
61+ ) {
62+ $ this ->_dataSaveAllowed = false ;
63+ }
64+
65+ return parent ::_beforeSave ();
66+ }
67+
68+ /**
69+ * Set the forced logging value
70+ *
71+ * @param bool $flag Flag
72+ * @return FireGento_AdminMonitoring_Model_History
73+ */
74+ public function setForcedLogging ($ flag )
75+ {
76+ $ this ->_forcedLogging = $ flag ;
77+
78+ return $ this ;
79+ }
80+
4781 /**
4882 * Retrieve the original model
4983 *
Original file line number Diff line number Diff line change 6969 <show_in_website >0</show_in_website >
7070 <show_in_store >0</show_in_store >
7171 </product_mass_update_logging >
72+ <exclude_admin_users translate =" label" >
73+ <label >Exclude admin users</label >
74+ <frontend_type >multiselect</frontend_type >
75+ <source_model >firegento_adminmonitoring/system_config_source_admin_user</source_model >
76+ <sort_order >50</sort_order >
77+ <show_in_default >1</show_in_default >
78+ <show_in_website >0</show_in_website >
79+ <show_in_store >0</show_in_store >
80+ </exclude_admin_users >
7281 </fields >
7382 </firegento_adminmonitoring >
7483 </groups >
You can’t perform that action at this time.
0 commit comments