ajout du fichier
This commit is contained in:
parent
bfadf6e1a6
commit
cfebaa9dc0
1 changed files with 30 additions and 0 deletions
30
inc/tester_autorisation.php
Normal file
30
inc/tester_autorisation.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?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;
|
||||
}
|
Loading…
Add table
Reference in a new issue