Compare commits
No commits in common. "e2da7e081fd368c0e04c5e12111139764cba3d83" and "afaa822d50318d6785f783a93f14296b915b3d6d" have entirely different histories.
e2da7e081f
...
afaa822d50
|
@ -21,9 +21,6 @@ class SecurityController extends Controller
|
|||
|
||||
public function loginAction(Request $request)
|
||||
{
|
||||
// Récupération de la cible de navigation
|
||||
$redirect = $request->get("redirect");
|
||||
|
||||
// Masteridentity
|
||||
$masteridentity=$this->getParameter("masteridentity");
|
||||
|
||||
|
@ -156,10 +153,8 @@ class SecurityController extends Controller
|
|||
$dispatcher = new EventDispatcher();
|
||||
$dispatcher->dispatch("security.interactive_login", $event);
|
||||
|
||||
if($redirect)
|
||||
return $this->redirect($redirect);
|
||||
else
|
||||
return $this->redirect($this->generateUrl('cadoles_core_home'));
|
||||
|
||||
return $this->redirect($this->generateUrl('cadoles_core_home'));
|
||||
}
|
||||
|
||||
public function logoutAction() {
|
||||
|
|
|
@ -224,9 +224,6 @@ class OnlyCommand extends Command
|
|||
if(!$group) {
|
||||
$namegroup=$onlygroup->id." - ".$onlygroup->title;
|
||||
|
||||
// On enlève les caractères interdis
|
||||
$namegroup=preg_replace('~[^ éèêôöàïî\'@a-zA-Z0-9._-]~', '', $namegroup);
|
||||
|
||||
// Ce nom de groupe existe-t-il déjà si oui erreur
|
||||
$group=$this->em->getRepository("CadolesCoreBundle:Group")->findBy(["label"=>$namegroup]);
|
||||
if($group)
|
||||
|
|
|
@ -110,17 +110,6 @@ class PurgeFileCommand extends Command
|
|||
}
|
||||
}
|
||||
|
||||
$fs = new Filesystem();
|
||||
$users=$this->em->getRepository("CadolesCoreBundle:User")->findAll();
|
||||
foreach($users as $user) {
|
||||
if(!$fs->exists($directory."/".$user->getAvatar())) {
|
||||
$this->writeln($user->getUsername());
|
||||
$user->setAvatar("noavatar.png");
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// /web/uploads/header
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== Directory = Header');
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
<?php
|
||||
namespace Cadoles\CoreBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Doctrine\DBAL\Connection as DBALConnection;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
use Cadoles\CoreBundle\Entity\User;
|
||||
|
||||
global $bdd01;
|
||||
global $config;
|
||||
|
||||
class ScriptCommand extends Command
|
||||
{
|
||||
private $container;
|
||||
private $em;
|
||||
private $output;
|
||||
private $filesystem;
|
||||
private $rootlog;
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('Core:Script')
|
||||
->setDescription('Lauch Script')
|
||||
->setHelp('Execeute some script : visibletrue / ')
|
||||
->addArgument('scriptname', InputArgument::OPTIONAL, 'scriptname')
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->container = $this->getApplication()->getKernel()->getContainer();
|
||||
$this->em = $this->container->get('doctrine')->getEntityManager();
|
||||
$this->output = $output;
|
||||
$this->filesystem = new Filesystem();
|
||||
$this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/";
|
||||
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== Core:Script');
|
||||
$this->writelnred('==========================================================================================================');
|
||||
|
||||
$scriptname = $input->getArgument('scriptname');
|
||||
$this->writeln($scriptname);
|
||||
|
||||
switch($scriptname) {
|
||||
case "visibletrue": $this->visibletrue(); break;
|
||||
}
|
||||
|
||||
$this->writeln('');
|
||||
return 1;
|
||||
}
|
||||
|
||||
private function visibletrue() {
|
||||
$users = $this->em->getRepository('CadolesCoreBundle:User')->findAll();
|
||||
foreach($users as $user) {
|
||||
if(!$user->getVisible()) {
|
||||
$this->writeln($user->getUsername());
|
||||
|
||||
$user->setVisible(true);
|
||||
$this->em->persist($user);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function writelnred($string) {
|
||||
$this->output->writeln('<fg=red>'.$string.'</>');
|
||||
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
|
||||
}
|
||||
private function writeln($string) {
|
||||
$this->output->writeln($string);
|
||||
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
|
|||
(-100, 'Interne', 'SIREN');
|
||||
|
||||
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
|
||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}oBuVhAUjam9tCeMBwS0xBsAM2PdHZLW3
|
||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}BkFFVAICIt3FUlHQLN1FsNWUtsPnLFRs
|
||||
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ use Symfony\Component\HttpFoundation\JsonResponse;
|
|||
use Symfony\Component\Form\FormError;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
use Cadoles\CoreBundle\Entity\Group;
|
||||
use Cadoles\CoreBundle\Entity\Usergroup;
|
||||
|
@ -525,15 +524,11 @@ class GroupController extends Controller
|
|||
|
||||
// Notification mail auprès de la personne inscrite
|
||||
if($group->getFgcanshare()) {
|
||||
$idpage =$group->getPages()->first()->getId();
|
||||
$url = $this->generateUrl('cadoles_core_home', ["id"=>$idpage], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
$texthtml="Vous venez d'être inscrit dans le groupe de travail : ".$group->getLabel()."<br>Suivez le lien suivant pour y accéder = <a href='$url'>$url</a>";
|
||||
$text="Vous venez d'être inscrit dans le groupe de travail : ".$group->getLabel()."<br>Suivez le lien suivant pour y accéder = $url";
|
||||
|
||||
$text="Vous venez d'être inscrit dans le groupe de travail : ".$group->getLabel();
|
||||
$template="template";
|
||||
$mail_params=array(
|
||||
"subject" => $this->get('session')->get('appname')." : Inscription au groupe de travail : ".$group->getLabel()."\n\n".$group->getDescription(),
|
||||
"body_html"=>$texthtml,
|
||||
"body_html"=>nl2br($text),
|
||||
"body_text"=>$text
|
||||
);
|
||||
$to = $user->getEmail();
|
||||
|
@ -992,7 +987,6 @@ class GroupController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getDatas()
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
|
|
@ -285,12 +285,12 @@ class RegistrationController extends Controller
|
|||
foreach($emailmodos as $emailmodo) {
|
||||
array_push($to,$emailmodo["email"]);
|
||||
}
|
||||
|
||||
$url = $this->generateUrl('cadoles_core_config_registration', '', UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
|
||||
$text="Un utilisateur dont le mail n’est pas en liste blanche souhaite s’inscrire au ".$appname.".\nMerci d’approuver son inscription pour finaliser celle-ci.";
|
||||
$mail_params=array(
|
||||
"subject" => $appname." : Inscription à valider",
|
||||
"body_html"=>"Un utilisateur dont le mail n’est pas en liste blanche souhaite s’inscrire au ".$appname.".\nMerci d’approuver son inscription pour finaliser celle-ci.<br><br>Veuillez vérifier cette inscription à cette adresse:<br><a href='$url'>$url</a>",
|
||||
"body_text"=>"Un utilisateur dont le mail n’est pas en liste blanche souhaite s’inscrire au ".$appname.".\nMerci d’approuver son inscription pour finaliser celle-ci.\n\nVeuillez vérifier cette inscription à cette adresse:\n$url"
|
||||
"subject" => $appname." : Inscription à valider",
|
||||
"body_html"=>nl2br($text),
|
||||
"body_text"=>$text
|
||||
);
|
||||
|
||||
$message = $this->container->get('cadoles.core.service.mail');
|
||||
|
|
|
@ -16,9 +16,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
|
||||
use Cadoles\CoreBundle\Entity\User;
|
||||
use Cadoles\CoreBundle\Entity\UserGroup;
|
||||
|
@ -768,77 +765,6 @@ class UserController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
|
||||
public function exportuserAction(Request $request) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$dir = $this->get('kernel')->getRootDir() . '/../uploads/export/';
|
||||
$file = "export.csv";
|
||||
|
||||
$fs = new Filesystem();
|
||||
$fs->mkdir($dir);
|
||||
|
||||
$csvh = fopen($dir.$file, 'w');
|
||||
$d = ';'; // this is the default but i like to be explicit
|
||||
$e = '"'; // this is the default but i like to be explicit
|
||||
|
||||
// Entête de colonne
|
||||
$data=["id","Login","Nom","Prénom","Email","Téléphone",$this->getParameter("labelniveau01"),$this->getParameter("labelniveau02"),"Métier","Fonction","Nom Usage","Autres Prénom","Sexe","Adresse","Date Naissance","Pays Naissance","Ville Naissance"];
|
||||
fputcsv($csvh, $data, $d, $e);
|
||||
|
||||
// Liste des utilisateurs en fonction du role de l'utilisateur en cours
|
||||
if($this->isGranted('ROLE_ADMIN')) {
|
||||
$users=$em->getRepository($this->labelentity)->findAll();
|
||||
}
|
||||
elseif($this->isGranted('ROLE_MODO')) {
|
||||
$qb = $em->createQueryBuilder();
|
||||
$users = $qb->select('user')
|
||||
->from($this->labelentity,'user')
|
||||
->from('CadolesCoreBundle:Niveau01','niveau01')
|
||||
->from('CadolesCoreBundle:UserModo', 'usermodo')
|
||||
->where('user.niveau01=niveau01.id')
|
||||
->andwhere("usermodo.niveau01 = user.niveau01")
|
||||
->andWhere("usermodo.user = :userid")
|
||||
->setParameter("userid", $this->getUser()->getId())
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
foreach($users as $user) {
|
||||
$groups="";
|
||||
foreach($user->getGroups() as $group) {
|
||||
$groups.=$group->getGroup()->getLabel()." ";
|
||||
}
|
||||
$data = [
|
||||
"id"=>$user->getId(),
|
||||
"username"=>$user->getUsername(),
|
||||
"name"=>$user->getLastname(),
|
||||
"firstname"=>$user->getFirstname(),
|
||||
"email"=>$user->getEmail(),
|
||||
"phone"=>$user->getTelephonenumber(),
|
||||
"niveau01"=>$user->getNiveau01()->getLabel(),
|
||||
"niveau02"=>($user->getNiveau02()?$user->getNiveau02()->getLabel():""),
|
||||
"job"=>$user->getJob(),
|
||||
"position"=>$user->getPosition(),
|
||||
"usualname"=>$user->getUsualname(),
|
||||
"givensname"=>$user->getGivensname(),
|
||||
"gender"=>$user->getGender(),
|
||||
"postaladress"=>$user->getPostaladress(),
|
||||
"birthdate"=>($user->getBirthdate()?$user->getBirthdate()->format("d/m/Y"):""),
|
||||
"birthcountry"=>($user->getBirthcountry()?$user->getBirthcountry()->getLabel():""),
|
||||
"birthplace"=>($user->getBirthplace()?$user->getBirthplace()->getLabel():""),
|
||||
|
||||
];
|
||||
|
||||
fputcsv($csvh, $data, $d, $e);
|
||||
}
|
||||
fclose($csvh);
|
||||
|
||||
$response = new BinaryFileResponse($dir.$file);
|
||||
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function importuserAction(Request $request) {
|
||||
if($this->GetParameter("masteridentity")!="SQL")
|
||||
throw $this->createNotFoundException('Permission denied');
|
||||
|
|
|
@ -266,10 +266,6 @@ cadoles_core_config_importuser_filectrl:
|
|||
path: /config/importuserfilectrl
|
||||
defaults: { _controller: CadolesCoreBundle:User:importuserfilectrl }
|
||||
|
||||
cadoles_core_config_user_export:
|
||||
path: /config/exportuser
|
||||
defaults: { _controller: CadolesCoreBundle:User:exportuser }
|
||||
|
||||
#-- Access user
|
||||
cadoles_core_user:
|
||||
path: /user
|
||||
|
|
|
@ -51,21 +51,10 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
|
||||
$('document').ready(function(){
|
||||
setTimeout(function(){
|
||||
//parent.location.reload();
|
||||
{% if redirectto is defined %}
|
||||
console.log("{{ redirectto }}");
|
||||
console.log("{{ mode_auth }}");
|
||||
{% if mode_auth == "CAS" %}
|
||||
parent.location.href = "{{ path("cas_sp.login", {redirect:redirectto}) }}";
|
||||
{% else %}
|
||||
parent.location.href = "{{ path("cadoles_core_home") }}";
|
||||
{% endif %}
|
||||
{% else %}
|
||||
//parent.location.href = "{{ path("cadoles_core_home") }}";
|
||||
{% endif %}
|
||||
parent.location.href = "{{ path("cadoles_core_home") }}";
|
||||
}, 2000);
|
||||
});
|
||||
{% endblock %}
|
||||
|
|
|
@ -9,7 +9,6 @@ td { font-size: 10px; }
|
|||
<h1 class="page-header">Gestion des Utilisateurs</h1>
|
||||
{% if masteridentity=="SQL" %}
|
||||
<a class="btn btn-success" href={{ path('cadoles_core_config_user_submit') }}>Ajouter</a>
|
||||
<a class="btn btn-success" href={{ path('cadoles_core_config_user_export') }}>Exporter CSV</a>
|
||||
<br><br>
|
||||
{% elseif masteridentity=="LDAP" %}
|
||||
<a class="btn btn-success" href={{ path('cadoles_core_config_user_sync') }}>Synchroniser avec Annuaire</a>
|
||||
|
|
|
@ -1258,7 +1258,7 @@ class PagewidgetController extends Controller
|
|||
return $this->render($this->labelentity.':viewflux.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canupdate' => $canupdate,
|
||||
'fluxs' => ["id"=>0],
|
||||
//'fluxs' => $fluxsordered,
|
||||
'access' => $access,
|
||||
'feeds' => $feeds,
|
||||
'modelist' => $modelist,
|
||||
|
@ -1865,10 +1865,6 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
// Trier les item par title
|
||||
$title = array_column($items, 'title');
|
||||
array_multisort($title, SORT_ASC, $items);
|
||||
|
||||
// Render
|
||||
return $this->render($this->labelentity.':viewappexternal.html.twig', [
|
||||
'entity' => $entity,
|
||||
|
|
|
@ -21,8 +21,7 @@ class DefaultController extends BaseController
|
|||
return $this->render('CadolesCoreBundle:Core:reconnect.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => false,
|
||||
'redirectto' => $this->get('session')->get("_security.main.target_path")
|
||||
'usesidebar' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -46,7 +45,6 @@ class DefaultController extends BaseController
|
|||
public function loginAction(Request $request)
|
||||
{
|
||||
$idpEntityId = $request->get('idp');
|
||||
|
||||
if (null === $idpEntityId) {
|
||||
return $this->redirect($this->generateUrl($this->container->getParameter('lightsaml_sp.route.discovery')));
|
||||
}
|
||||
|
|
|
@ -46,48 +46,10 @@ class CountMessageCommand extends Command
|
|||
$this->appname = $this->em->getRepository("CadolesCoreBundle:Config")->findOneBy(["id"=>"appname"])->getValue();
|
||||
$this->url= "https://".$this->container->getParameter('weburl')."/".$this->container->getParameter('alias');
|
||||
|
||||
$now=new \DateTime('now');
|
||||
$now->modify("-1 day");
|
||||
|
||||
// Pour chaque groupe purger l'ensemble des message > 100
|
||||
$groups=$this->em->getRepository("CadolesCoreBundle:Group")->findAll();
|
||||
foreach($groups as $group) {
|
||||
// On garde les 100 premiers
|
||||
$qb = $this->em->createQueryBuilder();
|
||||
$messagestokeep = $qb
|
||||
->select('m.id')
|
||||
->from('CadolesWebsocketBundle:Message', 'm')
|
||||
->where('m.group = :group')
|
||||
->setParameter('group', $group)
|
||||
->orderBy('m.id','DESC')
|
||||
->setMaxResults(100)
|
||||
->getQuery()->getArrayResult();
|
||||
|
||||
// Sur l'ensemble des messages
|
||||
$qb = $this->em->createQueryBuilder();
|
||||
$messages = $qb
|
||||
->select('m')
|
||||
->from('CadolesWebsocketBundle:Message', 'm')
|
||||
->where('m.group = :group')
|
||||
->setParameter('group', $group)
|
||||
->getQuery()->getResult();
|
||||
|
||||
foreach($messages as $message) {
|
||||
// S'il ne fait pas parties des 100 premiers on le supprime
|
||||
if(!in_array(["id"=>$message->getId()],$messagestokeep)) {
|
||||
$this->writeln("PURGE ".$message->getId());
|
||||
$this->em->remove($message);
|
||||
$this->em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Pour chaque utilisateur
|
||||
$users=$this->em->getRepository("CadolesCoreBundle:User")->findAll();
|
||||
foreach($users as $user) {
|
||||
$cptnotread=0;
|
||||
$body="";
|
||||
|
||||
// Pour chaque group de l'utilisateur
|
||||
foreach($user->getGroups() as $usergroup) {
|
||||
|
@ -95,22 +57,25 @@ class CountMessageCommand extends Command
|
|||
$group=$usergroup->getGroup();
|
||||
if($group->getFgcanshare()) {
|
||||
$qb = $this->em->createQueryBuilder();
|
||||
$messages = $qb
|
||||
->select('m')
|
||||
$tm = $qb ->select($qb->expr()->count('m.id'))
|
||||
->from('CadolesWebsocketBundle:Message', 'm')
|
||||
->where('m.group = :group')
|
||||
->andWhere('m.user != :user')
|
||||
->andWhere('m.submitdate >= :date')
|
||||
->setParameter('group', $group)
|
||||
->setParameter('user', $user)
|
||||
->setParameter('date',$now)
|
||||
->getQuery()->getResult();
|
||||
foreach($messages as $message) {
|
||||
if(!$message->getReaders() || !$message->getReaders()->contains($user)) {
|
||||
$cptnotread++;
|
||||
$body.="<hr><b>".$message->getGroup()->getLabel()."</b><br>".$message->getUser()->getLastname()." ".$message->getUser()->getFirstname()."<br><br>".$message->getTopic();
|
||||
}
|
||||
}
|
||||
->getQuery()->getSingleScalarResult();
|
||||
|
||||
$qb = $this->em->createQueryBuilder();
|
||||
$tr = $qb ->select($qb->expr()->count('m.id'))
|
||||
->from('CadolesWebsocketBundle:Message', 'm')
|
||||
->where('m.group = :group')
|
||||
->andWhere('m.user != :user')
|
||||
->andWhere(':user MEMBER OF m.readers')
|
||||
->setParameter('group', $group)
|
||||
->setParameter('user', $user)
|
||||
->getQuery()->getSingleScalarResult();
|
||||
|
||||
if($tm-$tr>0) $cptnotread+=($tm-$tr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,13 +87,13 @@ class CountMessageCommand extends Command
|
|||
|
||||
$mail_params=array(
|
||||
"subject" => $this->appname." : Messages non lus",
|
||||
"body_html"=>"<p>Vous avez ".$cptnotread." messages non lus sur ".$this->appname."</p><p>Vous pouvez les consulter sur <a href='".$this->url."'>".$this->url."</a></p>".$body,
|
||||
"body_text"=>"Vous avez ".$cptnotread." messages non lus sur ".$this->appname."\nVous pouvez les consulter sur ".$this->url.$body,
|
||||
"body_html"=>"<p>Vous avez ".$cptnotread." messages non lus sur ".$this->appname."</p><p>Vous pouvez les consulter sur <a href='".$this->url."'>".$this->url."</a></p>",
|
||||
"body_text"=>"Vous avez ".$cptnotread." messages non lus sur ".$this->appname."\nVous pouvez les consulter sur ".$this->url,
|
||||
);
|
||||
|
||||
$message = $this->container->get('cadoles.core.service.mail');
|
||||
$message->sendEmail($template, $mail_params, $user->getEmail(), $this->noreply, $this->appname);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->writeln('');
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue