53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Définit les autorisations du plugin GamuMail
|
|
*
|
|
* @plugin GamuMail
|
|
* @copyright 2020
|
|
* @author tofulm
|
|
* @licence GNU/GPL
|
|
* @package SPIP\Gamumail\Autorisations
|
|
*/
|
|
|
|
if (!defined('_ECRIRE_INC_VERSION')) {
|
|
return;
|
|
}
|
|
|
|
|
|
/**
|
|
* Fonction d'appel pour le pipeline
|
|
* @pipeline autoriser */
|
|
function gamumail_autoriser() {
|
|
}
|
|
|
|
|
|
// -----------------
|
|
// Objet gamumails
|
|
|
|
function autoriser_gamumail_creer_dist($faire, $type, $id, $qui, $opt) {
|
|
return $qui['statut'] == '0minirezo' and !$qui['restreint'];
|
|
}
|
|
|
|
function autoriser_gamumail_voir_dist($faire, $type, $id, $qui, $opt) {
|
|
return true;
|
|
}
|
|
|
|
function autoriser_gamumail_modifier_dist($faire, $type, $id, $qui, $opt) {
|
|
return $qui['statut'] == '0minirezo' and !$qui['restreint'];
|
|
}
|
|
|
|
function autoriser_gamumail_supprimer_dist($faire, $type, $id, $qui, $opt) {
|
|
return $qui['statut'] == '0minirezo' and !$qui['restreint'];
|
|
}
|
|
|
|
function autoriser_gamumail_configurer_dist($faire, $type, $id, $qui, $opt) {
|
|
return autoriser('webmestre');
|
|
}
|
|
/**
|
|
* Autorisation de modifier le nom d'un slug
|
|
* uniquement les webmestres avec un mail en @gamuza.fr
|
|
**/
|
|
function autoriser_gamumail_modifier_nom_slug_dist($faire, $type, $id, $qui, $opt) {
|
|
return $qui['webmestre'] === "oui"
|
|
and strpos($qui['email'], 'gamuza.fr') !== false;
|
|
}
|