Skip to content

Commit

Permalink
Merge pull request #147 from gregorybesson/develop
Browse files Browse the repository at this point in the history
userLog
  • Loading branch information
gregorybesson authored Jun 24, 2019
2 parents 6a91b3f + 6f1f244 commit a2cb897
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Form/LoginFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ class LoginFilter extends \ZfcUser\Form\LoginFilter
{
public function __construct(AuthenticationOptionsInterface $options)
{
$this->add(array(
'name' => 'remember_me',
'required' => false,
'allowEmpty' => true,
));
$this->add(
array(
'name' => 'remember_me',
'required' => false,
'allowEmpty' => true,
)
);

parent::__construct($options);
}
Expand Down
28 changes: 28 additions & 0 deletions src/Service/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,34 @@ public function getCSV($array)
return ob_get_clean(); // ... then return it as a string!
}


public function getUserActions()
{
$config = $this->serviceManager->get('config');
$logFrontendUser = ($config['playgrounduser']['log_frontend_user']) ? $config['playgrounduser']['log_frontend_user'] : false;
$routes = [];

// echo '$controllerClass : ' . $controllerClass . '<br/>';
// echo '$moduleName : ' .$moduleName. '<br/>';
// echo '$routeName : '.$routeName. '<br/>';
// echo '$areaName : '.$areaName. '<br/>';
// echo '$controllerName : ' .$controllerName. '<br/>';
// echo '$actionName : ' . $actionName. '<br/>';
if ($logFrontendUser) {
$em = $this->getServiceManager()->get('doctrine.entitymanager.orm_default');
$emConfig = $em->getConfiguration();
$emConfig->addCustomStringFunction('SUBSTRING_INDEX', '\DoctrineExtensions\Query\Mysql\SubstringIndex');
$query = $em->createQuery(
"select DISTINCT CONCAT(SUBSTRING_INDEX(ul.controllerClass, '\\', -1), '/', ul.actionName) as path from PlaygroundUser\Entity\UserLog ul
WHERE SUBSTRING_INDEX(ul.uri, '.', -1) NOT IN ('jpg','svg','gif','png','css','js')
AND ul.areaName = 'frontend'"
);
$routes = $query->getResult();
}

return $routes;
}

public function findAll()
{
return $this->getUserMapper()->findAll();
Expand Down

0 comments on commit a2cb897

Please sign in to comment.