From 0feb7ecfee24deba21c6a08301f6fd7e04ad4519 Mon Sep 17 00:00:00 2001 From: clem Date: Mon, 28 Sep 2020 00:46:48 +0200 Subject: [PATCH] =?UTF-8?q?mise=20au=20carr=C3=A9=20des=20autorisations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/creer_slug.php | 2 +- action/gamuform_add_pdf.php | 6 +----- action/supprimer_slug.php | 2 +- action/switcher_slug_public.php | 2 +- gamumail_autorisations.php | 4 ++-- inclure/gamumail_config.html | 13 +++++++++---- inclure/gamumail_pdfs.html | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/action/creer_slug.php b/action/creer_slug.php index 07e0e5d..e94b75e 100644 --- a/action/creer_slug.php +++ b/action/creer_slug.php @@ -18,7 +18,7 @@ include_spip('inc/autoriser'); function action_creer_slug_dist(){ include_spip('inc/autoriser'); - if (! autoriser("webmestre")) { + if (!autoriser('creer','gamumail')) { return false; } diff --git a/action/gamuform_add_pdf.php b/action/gamuform_add_pdf.php index bb5a47a..0ce581a 100644 --- a/action/gamuform_add_pdf.php +++ b/action/gamuform_add_pdf.php @@ -6,17 +6,13 @@ function action_gamuform_add_pdf_dist(){ return false; include_spip('inc/autoriser'); - if (! autoriser("etre","connecte")) { + if (!autoriser('modifier','gamumail')) { return false; } $securiser_action = charger_fonction('securiser_action', 'inc'); $arg = $securiser_action(); $id_gamumail = $arg; - include_spip('inc/autoriser'); - if (! autoriser("webmestre")) { - return false; - } if (intval($id_gamumail)) { sql_insertq('spip_gamumail_pdfs',['id_gamumail' => intval($id_gamumail)]); diff --git a/action/supprimer_slug.php b/action/supprimer_slug.php index 9e9f0f3..c2a5c9b 100644 --- a/action/supprimer_slug.php +++ b/action/supprimer_slug.php @@ -16,7 +16,7 @@ include_spip('inc/autoriser'); function action_supprimer_slug_dist(){ include_spip('inc/autoriser'); - if (! autoriser("webmestre")) { + if (!autoriser('supprimer','gamumail')) { return false; } diff --git a/action/switcher_slug_public.php b/action/switcher_slug_public.php index eb5af81..86947fe 100644 --- a/action/switcher_slug_public.php +++ b/action/switcher_slug_public.php @@ -16,7 +16,7 @@ include_spip('inc/autoriser'); function action_switcher_slug_public_dist(){ include_spip('inc/autoriser'); - if (! autoriser("webmestre")) { + if (!autoriser('modifier','gamumail')) { return false; } diff --git a/gamumail_autorisations.php b/gamumail_autorisations.php index e47ea8f..568d554 100644 --- a/gamumail_autorisations.php +++ b/gamumail_autorisations.php @@ -38,7 +38,7 @@ function gamumail_autoriser() { * @return bool true s'il a le droit, false sinon **/ function autoriser_gamumail_creer_dist($faire, $type, $id, $qui, $opt) { - return in_array($qui['statut'], array('0minirezo', '1comite')); + return $qui['statut'] == '0minirezo' and !$qui['restreint']; } /** @@ -66,7 +66,7 @@ function autoriser_gamumail_voir_dist($faire, $type, $id, $qui, $opt) { * @return bool true s'il a le droit, false sinon **/ function autoriser_gamumail_modifier_dist($faire, $type, $id, $qui, $opt) { - return in_array($qui['statut'], array('0minirezo', '1comite')); + return $qui['statut'] == '0minirezo' and !$qui['restreint']; } /** diff --git a/inclure/gamumail_config.html b/inclure/gamumail_config.html index 949fc80..4441fc0 100644 --- a/inclure/gamumail_config.html +++ b/inclure/gamumail_config.html @@ -1,3 +1,5 @@ +[(#AUTORISER{modifier,gamumail}|sinon_interdire_acces)] +