From 4c707c5899e593df8378d1ba07221f33fcb87ff6 Mon Sep 17 00:00:00 2001 From: afornerot Date: Tue, 16 Mar 2021 10:37:36 +0100 Subject: [PATCH] =?UTF-8?q?mise=20=C3=A0=20plat=20des=20r=C3=A8gles=20de?= =?UTF-8?q?=20d=C3=A9sinscription=20(ref=20#235)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CoreBundle/Controller/GroupController.php | 11 ++++++++--- .../Resources/views/Config/list.html.twig | 2 ++ .../Resources/views/User/edit.html.twig | 18 +++++++++++++----- tmpl/ninegate-init-01.sql | 3 ++- 4 files changed, 25 insertions(+), 9 deletions(-) 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 fe0e6143..b5047643 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/GroupController.php @@ -175,7 +175,7 @@ class GroupController extends Controller if(!$data->getFgall()) $action .="$data->getId()))."'>"; if($data->getFgcanshare()) - $action.="$data->getId()))."'>"; + $action.="$data->getId()))."'>"; } else { $fgproprio=($user==$data->getOwner()); @@ -194,11 +194,16 @@ class GroupController extends Controller $action .="$data->getId()))."'>"; } else { - $action.="$data->getId()))."'>"; + // On ne peut se désinscrire que si le groupe est ouvert et qu'il n'est pas lié à un groupe ldap ou sso + $fgcanleave=true; + if($data->getFgtemplate() or $data->getFgall()) $fgcanleave=false; + elseif(!$data->getFgcanshare() && !$data->getFgopen()) $fgcanleave=false; + elseif($data->getFgcanshare() && !$this->get('session')->get('permunsubscribe') && !$data->getFgopen()) $fgcanleave=false; + if($fgcanleave) $action.="$data->getId()))."'>"; } if($data->getFgcanshare()) - $action.="$data->getId()))."'>"; + $action.="$data->getId()))."'>"; } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Config/list.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Config/list.html.twig index 7a8e0202..be686877 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Config/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Config/list.html.twig @@ -17,6 +17,7 @@ Action Ordre Clé + Description Valeur @@ -38,6 +39,7 @@ {{ config.order }} {{ config.id }} + {{ config.help|raw }} {% if config.type == "boolean" %} {% if config.value == "0" %} diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig index 80d90126..8522fdf1 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig @@ -182,13 +182,21 @@ {% for group in user.groups %} - {% if access=="config" and not group.group.fgall and group.group.ldapfilter=="" and group.group.attributes =="" %} - - {% elseif (group.group.fgopen or group.group.fgcanshare) and group.group.owner!=app.user and not group.group.fgall and group.group.ldapfilter=="" and group.group.attributes =="" %} + {% set canleave = true %} + {% if group.group.fgtemplate or group.group.fgall or group.group.owner==user %} + {% set canleave = false %} + {% elseif access!="config" %} + {% if not group.group.fgcanshare and not group.group.fgopen %} + {% set canleave = false %} + {% elseif group.group.fgcanshare and not app.session.get('permunsubscribe') and not group.group.fgopen %} + {% set canleave = false %} + {% endif %} + {% endif %} + + {% if canleave %} {% else %} - - + {% endif %} diff --git a/tmpl/ninegate-init-01.sql b/tmpl/ninegate-init-01.sql index 2e1a423a..702d2dba 100644 --- a/tmpl/ninegate-init-01.sql +++ b/tmpl/ninegate-init-01.sql @@ -120,6 +120,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type %end if ('500', 1, 1, 1, 'permgroup', 'permgroup', 'ROLE_ANIM', '', 'Determine quel rôle aura la permission de créer des groupes de travail'), -('501', 1, 1, 1, 'permgroup', 'permannu', 'ROLE_USER', '', 'Determine quel rôle aura la permission de voir l\'annuaire'); +('501', 1, 1, 1, 'permgroup', 'permannu', 'ROLE_USER', '', 'Determine quel rôle aura la permission de voir l\'annuaire'), +('502', 1, 1, 1, 'boolean', 'permunsubscribe', '0', '', 'Permettre aux utilisateurs de se désinscrire par eux-mêmes des groupes de travail');