0

I need to log any action made by users in sfDoctrineGuard plugin. Basically I'll need to log:

module/action
date
IP from where users are accessing the application

Any plugin? Is that possible? How?

Reynier
  • 2,420
  • 11
  • 51
  • 91

1 Answers1

1

This could be probably the plugin you need, sfDoctrineGuardLoginHistoryPlugin and allows to extend the information that you save.

Check for more plugins here.

Take a look at the code of the plugin, you just need to change the following file: PluginUserLoginHistoryTable.class.php

Add in the function writeLoginHistory and createHistoryEntry the information you want:

writeLoginHistory(sfEvent $event) {
//... same code than in the plugin
//lets save module and action
  if (!isset($request) )
  {
    $sActionName = sfContext::getInstance()->getActionName();
    $sModuleName = sfContext::getInstance()->getModuleName();
  }
  else
  {
    if (isset($request["module"]))
    {
      $sActionName = $request["action"];
      $sModuleName = $request["module"];
    }
  }

  //get values from the http bar URL
  if (!isset($sModuleName))
  {
    $sFullURL = sfContext::getInstance()->getRouting()->getCurrentInternalUri();
    ///... strip action and module name from the above URL
  }
}

Remember to pass those values to createHistoryEntry function and also to update that function with more input values to be saved.

xtrm
  • 966
  • 9
  • 22
  • thanks, this is exactly what I was looking for, I read the docs but can you wrote a example in how to save `module/action`? I mean where or better how do I get this part – Reynier Jun 26 '13 at 07:02
  • Edited above post to save action and module, check plugin info for more changes. – xtrm Jun 26 '13 at 08:30