52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Définit les autorisations du plugin GamuCompte
|
|
*
|
|
* @plugin GamuCompte
|
|
* @copyright 2020
|
|
* @author tofulm
|
|
* @licence GNU/GPL
|
|
* @package SPIP\Gamucompte\Autorisations
|
|
*/
|
|
|
|
if (!defined('_ECRIRE_INC_VERSION')) {
|
|
return;
|
|
}
|
|
|
|
|
|
/**
|
|
* Fonction d'appel pour le pipeline
|
|
* @pipeline autoriser */
|
|
function comptespip_autoriser() {
|
|
}
|
|
|
|
/*
|
|
* surcharge de la fonction native de SPIP
|
|
* return true si le champ statut de la config du plugin est renseigné
|
|
*/
|
|
function autoriser_inscrireauteur($faire, $quoi, $id, $qui, $opt) {
|
|
$mode = lire_config('comptespip/statut');
|
|
if ($mode) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function autoriser_comptespip_administrer_dist($faire, $type, $id, $qui, $opt) {
|
|
return in_array($qui['statut'], array('0minirezo'));
|
|
}
|
|
|
|
function autoriser_comptespip_modifier_dist($faire, $type, $id, $qui, $opt) {
|
|
if (autoriser('administrer','comptespip')) {
|
|
return true;
|
|
}
|
|
if ($id === $qui['id_auteur']) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function autoriser_comptespip_supprimer_dist($faire, $type, $id, $qui, $opt) {
|
|
return true;
|
|
}
|
|
|