@@ -778,9 +778,10 @@ public function addToGroup(Group $group)
778778
779779 // slugs
780780 $ monitored_security_groups = Config::get ("audit.monitored_security_groups_set " );
781+ Log::debug (sprintf ("User::addToGroup monitored security groups %s " , implode (', ' , $ monitored_security_groups )));
781782 if (in_array ($ group ->getSlug (), $ monitored_security_groups )) {
782783 // trigger job
783- // trigger job
784+ Log:: debug ( sprintf ( " User::addToGroup dispatching NotifyMonitoredSecurityGroupActivity for user %s group %s " , $ this -> id , $ group -> getSlug ()));
784785 NotifyMonitoredSecurityGroupActivity::dispatch (
785786 NotifyMonitoredSecurityGroupActivity::ACTION_ADD_2_GROUP ,
786787 $ this ->id ,
@@ -833,14 +834,27 @@ public function removeFromGroup(Group $group)
833834 "Only Super Admins can remove users from groups " ,
834835 );
835836 }
837+
838+ $ action = sprintf
839+ (
840+ "REMOVE FROM GROUP (%s) BY USER %s (%s) " ,
841+
842+ $ group ->getName (),
843+ $ current_user ->getEmail (),
844+ $ current_user ->getId ()
845+ );
846+
847+ AddUserAction::dispatch ($ this ->id , IPHelper::getUserIp (), $ action );
836848 }
837849
838850 if (!$ this ->groups ->contains ($ group )) return ;
839851 $ this ->groups ->removeElement ($ group );
840852 // slugs
841853 $ monitored_security_groups = Config::get ("audit.monitored_security_groups_set " );
854+ Log::debug (sprintf ("User::removeFromGroup monitored security groups %s " , implode (', ' , $ monitored_security_groups )));
842855 if (in_array ($ group ->getSlug (), $ monitored_security_groups )) {
843856 // trigger job
857+ Log::debug (sprintf ("User::removeFromGroup dispatching NotifyMonitoredSecurityGroupActivity for user %s group %s " , $ this ->id , $ group ->getSlug ()));
844858 NotifyMonitoredSecurityGroupActivity::dispatch (
845859 NotifyMonitoredSecurityGroupActivity::REMOVE_FROM_GROUP ,
846860 $ this ->id ,
0 commit comments