30 lines
545 B
PHP
30 lines
545 B
PHP
<?php
|
|
if (!defined('_ECRIRE_INC_VERSION')){
|
|
return;
|
|
}
|
|
|
|
|
|
function tester_autorisation($faire, $type, $qui, $secret = true) {
|
|
include_spip('inc/autoriser');
|
|
if (autoriser('webmestre', null, null, $qui, null)) {
|
|
return true;
|
|
}
|
|
|
|
if ($secret) {
|
|
if (pipeline('super_autorisation',$qui)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
$Tauts = [];
|
|
if (!empty($qui['autorisations'])) {
|
|
$Tauts = json_decode($qui['autorisations'],true);
|
|
}
|
|
|
|
if (array_key_exists($type, $Tauts)) {
|
|
if (in_array($faire, $Tauts[$type])) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|