From aa105431e23c787514e570e25dd29c4a3109f121 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 31 Jan 2017 10:05:06 +0100 Subject: [PATCH] Fixed AuthSystem with default class name assignation --- build/api/core/Request.php | 19 ++++++++++++------- build/viewer/view/machine/view.php | 1 - 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/build/api/core/Request.php b/build/api/core/Request.php index 294a8a7..1656694 100644 --- a/build/api/core/Request.php +++ b/build/api/core/Request.php @@ -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 ){ diff --git a/build/viewer/view/machine/view.php b/build/viewer/view/machine/view.php index 0de1967..b44ce60 100755 --- a/build/viewer/view/machine/view.php +++ b/build/viewer/view/machine/view.php @@ -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();