if you want to moudle wise permission to user in symfony
its work in symfony 1.4 and sfDoctrineGuardPlugin 5.0
add permission (permssion name is credential name)
and group (group name is module name)
now create one filterfile (filterfile add in /apps/appname(frontend|backend)/lib) folder
<?php
class groupcheckFilter extends sfFilter
{
public function execute($filterChain)
{
// Filters don't have direct access to the request and user objects.
// You will need to use the context object to get them
$context = $this->getContext();
$request = $context->getRequest();
$user = $context->getUser();
//$user->getAllPermissionNames();
$user_group = $user->getGroupNames();
echo $module = $context->getModuleName();
//secure file in default folder so bellow if condition and redirect path
if (!in_array($module,$user_group) && $module != 'default')
{
return $context->getController()->redirect('/default/secure/');
}else {
// Execute next filter
$filterChain->execute();
}
}
}
?>
file save with groupcheckfilter.class.php
in app.yml file add bellow line after security: or # insert your own filters here
groupcheck:
class: groupcheckFilter
Freelance Web Programmer, Android, Php 5, java, MySql, JQuery, Symfony framework, Smarty template, facebook application, googlemap application
Subscribe to:
Posts (Atom)
how to see xml preview in browser php
xml preview view in browser $xml = new DOMDocument('1.0', 'UTF-8'); $xml->preserveWhiteSpace = false; ...
-
Weather In Summer: 33.8 C (Max) - 23.3 C (Min) In winter: 20.3 C (Max) - 0 C (Min) Rainy Season : from July to Mid Sept, and very humid (Upt...
-
go to In httpd.conf add comment bellow line userdir disabled ----------------------------------------------- chmod 711 for /home/userdir(use...
-
The contents of my /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX=permissive # enforcing - ...