From 48aadff221525976b4ea649ec8753cf1f71f95a5 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 19 Jul 2016 19:49:46 +0200 Subject: [PATCH] Correction 'indexOf' --- test/client/interface.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/test/client/interface.php b/test/client/interface.php index 7b0ad13..39f3d27 100644 --- a/test/client/interface.php +++ b/test/client/interface.php @@ -363,15 +363,7 @@ for( var a in Object.keys(ACTIONS[COUNT]) ){ /* (3) On vérifie que l'utilisateur a la permissions d'effectuer l'action */ - var hasPermission = false; - - // On vérifie parmis toutes les permissions de cette CARTE - if( PERMISSIONS.hasOwnProperty(CARD) ) - for( var i = 0 ; i < PERMISSIONS[CARD].length ; i++ ) - if( PERMISSIONS[CARD][i] == ACTIONS[COUNT][a].id_action ){ - hasPermission = true; - break; - } + var hasPermission = PERMISSIONS.hasOwnProperty(CARD) && PERMISSIONS[CARD].indexOf( ACTIONS[COUNT][a].id_action.toString() ) > -1; // Si on a pas la permission, on quitte if( !hasPermission ) continue;