From 569d594c822812cb73ab555b1a3e6a346bed32b5 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 8 Nov 2016 10:37:29 +0100 Subject: [PATCH] auth upgrade --- build/api/core/Authentification.php | 11 ++++++++--- config/modules.json | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build/api/core/Authentification.php b/build/api/core/Authentification.php index cdb1dea..48c4a3c 100644 --- a/build/api/core/Authentification.php +++ b/build/api/core/Authentification.php @@ -105,8 +105,8 @@ file_put_contents($fn, $GLOBALS['TOKEN']); /* (5) Stores permission */ - if( !in_array('cyclic-hash-system', $GLOBALS['PERM']) ) - $GLOBALS['PERM'][] = 'cyclic-hash-system'; + if( !in_array('cyclic-hash', $GLOBALS['PERM']) ) + $GLOBALS['PERM'][] = 'cyclic-hash'; /* [3] Returns true if no error @@ -127,8 +127,13 @@ * */ public static function permission($module, $expected){ - /* [1] Mise à jour de l'authentification + /* [1] Setup =========================================================*/ + /* (1) If no expected, return true */ + if( !is_array($expected) || count($expected) === 0 ) + return true; + + /* (2) Mise à jour de l'authentification */ self::check(); diff --git a/config/modules.json b/config/modules.json index 68a6c7b..e438ead 100755 --- a/config/modules.json +++ b/config/modules.json @@ -3,7 +3,7 @@ "authentification": { "renew": { "description": "Renewal of the cyclic hashing system.", - "permission": ["cyclic-hash-system"], + "permission": ["cyclic-hash"], "parameters": { "hash": { "description": "new hash to store.", "type": "hash" } } @@ -14,7 +14,7 @@ "release": { "pull": { "description": "Pulls project from git branch.", - "permissions": ["cyclic-hash-system"], + "permissions": ["cyclic-hash"], "parameters": { "project": { "description": "Project's name.", "type": "varchar(2,30,alphanumeric)" }, "branch": { "description": "Git release branch.", "type": "varchar(2,30,alphanumeric)" }