This commit is contained in:
afornerot 2019-07-23 16:33:41 +02:00
parent 05a2fe97bc
commit 8ad58b3d93
5 changed files with 57 additions and 4 deletions

View File

@ -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());
@ -125,12 +126,15 @@ class GroupController extends Controller
$qb->orderBy('table.fgcanshare',$order[0]["dir"]);
break;
case 5 :
$qb->orderBy('table.fgcancreatepage',$order[0]["dir"]);
$qb->orderBy('u.username',$order[0]["dir"]);
break;
case 6 :
$qb->orderBy('table.fgcancreatecalendar',$order[0]["dir"]);
$qb->orderBy('table.fgcancreatepage',$order[0]["dir"]);
break;
case 7 :
$qb->orderBy('table.fgcancreatecalendar',$order[0]["dir"]);
break;
case 8 :
$qb->orderBy('table.fgcancreateblog',$order[0]["dir"]);
break;
}
@ -171,6 +175,9 @@ class GroupController extends Controller
if($fgproprio||$fgmanager) {
$action .="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_users', array('id'=>$data->getId()))."'><i class='fa fa-users fa-2x fa-fw'></i></a>";
}
else {
$action.="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_out', array('id'=>$data->getId()))."' data-method='out'><i class='fa fa-sign-out fa-fw fa-2x'></i></a>";
}
}
@ -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.="<img src='/".$this->container->getParameter('alias')."/uploads/avatar/".$data->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<br>".$user->getLastname()." ".$user->getFirstname()."<br>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

View File

@ -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")
*/

View File

@ -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

View File

@ -35,6 +35,7 @@
<th class="no-sort {% if masteridentity=="SQL" %} no-visible {% endif %}">Filtre</th>
{% if portal_activate %}
<th>Groupe de Travail</th>
<th>Propriétaire</th>
{% if access=="config" %}
<th>Création Pages</th>
<th>Création Calendriers</th>
@ -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 %}

View File

@ -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")}