【问题标题】:Log any action made by users in sfDoctrineGuard在 sfDoctrineGuard 中记录用户所做的任何操作
【发布时间】:2013-06-23 01:53:15
【问题描述】:

我需要记录用户在 sfDoctrineGuard 插件中所做的任何操作。基本上我需要登录:

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

任何插件?那可能吗?怎么样?

【问题讨论】:

    标签: symfony1 symfony-1.4 sfdoctrineguard


    【解决方案1】:

    这可能是您需要的插件,sfDoctrineGuardLoginHistoryPlugin 并允许扩展您保存的信息。

    查看更多插件here

    看一下插件的代码,你只需要更改以下文件:PluginUserLoginHistoryTable.class.php

    在函数writeLoginHistorycreateHistoryEntry中添加你想要的信息:

    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
      }
    }
    

    请记住将这些值传递给 createHistoryEntry 函数,并使用要保存的更多输入值更新该函数。

    【讨论】:

    • 谢谢,这正是我想要的,我阅读了文档,但你能写一个如何保存module/action 的例子吗?我的意思是我在哪里或更好地如何获得这部分
    • 编辑以上帖子以保存操作和模块,检查插件信息以获取更多更改。
    猜你喜欢
    • 2023-02-07
    • 2019-03-29
    • 2017-02-07
    • 2012-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-23
    • 1970-01-01
    相关资源
    最近更新 更多