Fixed AuthSystem with default class name assignation

This commit is contained in:
xdrm-brackets 2017-01-31 10:05:06 +01:00
parent 8d85764542
commit aa105431e2
2 changed files with 12 additions and 8 deletions

View File

@ -462,15 +462,20 @@
/* [2] Vérification des permissions et de l'authentification
=========================================================*/
var_dump(self::$authsystem);
die('error line 466');
// if no AuthSystem set up, deny by default
//if( !self::$authsystem instanceof AuthSystem )
// return false;
// if no AuthSystem set up, use the default one
if( !self::$authsystem instanceof AuthSystem ){
// try to load default AuthSystem
if( !file_exists(__BUILD__.'/api/core/AuthSystemDefault.php') )
return false;
// load default AuthSystem class
$classname = '\\api\\core\\AuthSystemDefault';
self::$authsystem = new $classname();
}
// Check permission using user-implemented AuthSystem
$granted = self::$authsystem::permission();
//$granted = self::$authsystem::permission( $this->path['module'], $method['permissions'] );
$granted = self::$authsystem::permission( $this->path['module'], $method['permissions'] );
/* (1) On retourne FAUX si aucun droit n'a ete trouve */
if( $granted->get() !== Err::Success ){

View File

@ -44,7 +44,6 @@
$request = new Request('machineDefault/getClusters', [
'id_machine' => (int) $id_machine
]);
var_dump('r2 - machine/view.php:47', $request->error->get());
$answer = $request->dispatch();