diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php index 0d086f5e..627bd2cf 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php @@ -106,6 +106,7 @@ class GroupController extends Controller ->andWhere(("table.fgcanshare=:flag")) ->andWhere("table.id=ug.group") ->andWhere(":user=ug.user") + ->leftJoin('CadolesCoreBundle:User', 'u', 'WITH', 'table.owner = u.id') ->setParameter("flag", true) ->setParameter("user", $this->getUser()); @@ -123,14 +124,17 @@ class GroupController extends Controller break; case 4 : $qb->orderBy('table.fgcanshare',$order[0]["dir"]); - break; + break; case 5 : + $qb->orderBy('u.username',$order[0]["dir"]); + break; + case 6 : $qb->orderBy('table.fgcancreatepage',$order[0]["dir"]); break; - case 6 : + case 7 : $qb->orderBy('table.fgcancreatecalendar',$order[0]["dir"]); break; - case 7 : + case 8 : $qb->orderBy('table.fgcancreateblog',$order[0]["dir"]); break; } @@ -171,6 +175,9 @@ class GroupController extends Controller if($fgproprio||$fgmanager) { $action .="$data->getId()))."'>"; } + else { + $action.="$data->getId()))."' data-method='out'>"; + } } @@ -179,12 +186,19 @@ class GroupController extends Controller if($this->GetParameter("masteridentity")=="LDAP") $filtre=$data->getLdapfilter(); if($this->GetParameter("masteridentity")=="SSO") $filtre=$data->getAttributes(); + $user=""; + if($data->getOwner()) { + $user.="getOwner()->getAvatar()."' class='avatar' style='margin:0px 5px 0px 0px;display:inline-block;'>"; + $user.=$data->getOwner()->getUsername(); + } + array_push($output["data"],array( $action, $data->getLabel(), ($data->getFgopen()?"oui":"non"), $filtre, ($data->getFgcanshare()?"oui":"non"), + $user, ($data->getFgcancreatepage()?"oui":"non"), ($data->getFgcancreatecalendar()?"oui":"non"), ($data->getFgcancreateblog()?"oui":"non"), @@ -536,6 +550,24 @@ class GroupController extends Controller return $response; } + public function outAction(Request $request,$id,$access="config") + { + $em = $this->getDoctrine()->getManager(); + $group=$em->getRepository("CadolesCoreBundle:Group")->find($id); + if($group->getFgAll()||$group->getFgTemplate()) + throw $this->createNotFoundException('Permission denied'); + + $usergroup = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$this->getUser(),"group"=>$id)); + $user=$em->getRepository("CadolesCoreBundle:User")->find($this->getUser()); + $message="Désinscription de l'utilisateur
".$user->getLastname()." ".$user->getFirstname()."
Par ".$this->getUser()->getLastname()." ".$this->getUser()->getFirstname();; + $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($usergroup->getKeyvalue(),$this->getUser()->getId(),$id,$message); + + $em->remove($usergroup); + $em->flush(); + + return $this->redirect($this->generateUrl("cadoles_core_user_group")); + } + public function switchmanagerAction(Request $request,$access="config") { // S'assurer que c'est un appel ajax diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php index 4dcfbb5f..f92420ec 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Entity/Group.php @@ -143,6 +143,11 @@ class Group */ protected $calendars; + /** + * @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Calendarevent", mappedBy="groups") + */ + protected $calendarevents; + /** * @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Blog", mappedBy="groups") */ diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml index 1453779c..96076d01 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml @@ -381,6 +381,10 @@ cadoles_core_user_group_users: path: /user/group/users/{id} defaults: { _controller: CadolesCoreBundle:Group:users, access: user } +cadoles_core_user_group_out: + path: /user/group/out/{id} + defaults: { _controller: CadolesCoreBundle:Group:out, access: user } + cadoles_core_user_group_ajax_usersnotin: path: /user/group/ajax/usersnotin/{id} defaults: { _controller: CadolesCoreBundle:Group:ajaxusersnotin, access: user } @@ -401,6 +405,9 @@ cadoles_core_user_group_ajax_switchmanager: path: /user/group/ajax/switchmanager defaults: { _controller: CadolesCoreBundle:Group:switchmanager, access: user } + + + #== Whitelist ============================================================================================================ cadoles_core_config_whitelist: path: /config/whitelist diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/list.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/list.html.twig index eec01ec2..c15eb08d 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Group/list.html.twig @@ -35,6 +35,7 @@ Filtre {% if portal_activate %} Groupe de Travail + Propriétaire {% if access=="config" %} Création Pages Création Calendriers @@ -60,6 +61,14 @@ processing: true, serverSide: true, ajax: "{{ path('cadoles_core_'~access~'_group_ajax_list') }}", + + drawCallback: function(settings) { + $("a[data-method='out']").click(function(){ + if( !confirm('Êtes-vous sûr de vouloir vous désinscrire de ce groupe ?')) { + return false; + } + }); + } }); }); {% endblock %} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Calendarevent.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Calendarevent.php index 5baa9730..b493d3e9 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Calendarevent.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Calendarevent.php @@ -67,7 +67,7 @@ class Calendarevent private $roles; /** - * @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", inversedBy="calendars", cascade={"persist"}) + * @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", inversedBy="calendarevents", cascade={"persist"}) * @ORM\JoinTable(name="calendareventgroupe", * joinColumns={@ORM\JoinColumn(name="calendarevent", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="groupe", referencedColumnName="id")}