Compare commits

..

No commits in common. "cce91c421a95855e8fd7843966a13847f7196dad" and "5dd372f2a2bbea3d7fa1c2af3ee17a3b1c494c25" have entirely different histories.

View File

@ -69,28 +69,16 @@ class ApiController extends Controller
// Récupération UID // Récupération UID
$username = \phpCAS::getUser(); $username = \phpCAS::getUser();
$attributes = \phpCAS::getAttributes(); $attributes = \phpCAS::getAttributes();
if(isset($attributes[$this->getParameter('user_attr_cas_username')]))
$login = $attributes[$this->getParameter('user_attr_cas_username')]; return $this->render('CadolesEdispatcherBundle:Test:test.html.twig',[
$user=$em->getRepository('CadolesCoreBundle:User')->findOneBy(["username"=>$login]); 'useheader' => true,
if(!$user) { 'usemenu' => false,
$output["error"]="user does not exist"; 'usesidebar' => false,
return new Response(json_encode($output), 400); 'attributes' => $attributes,
} 'groups' => $groups,
$roles=($user?$user->getRoles():["ROLE_ANONYME"]); 'username' => $username,
if (in_array("ROLE_ADMIN",$roles)) { 'datasource' => $datasource,
return $this->render('CadolesEdispatcherBundle:Test:test.html.twig',[ ]);
'useheader' => true,
'usemenu' => false,
'usesidebar' => false,
'attributes' => $attributes,
'groups' => $groups,
'username' => $username,
'datasource' => $datasource,
]);
} else {
$output["error"]="access not granted";
return new Response(json_encode($output), 403);
}
} }