[Nagvis-checkins] SF.net Git: nagvis: FIX: Last assigned role can now be removed from a user
Brought to you by:
larsi-
From: LaMi <la...@us...> - 2014-04-04 22:21:31
|
Author: Lars Michelsen <lm...@la...> Date: Sat Apr 5 00:02:34 2014 +0200 Committer: Lars Michelsen <lm...@la...> Commit-Date: Sat Apr 5 00:02:34 2014 +0200 FIX: Last assigned role can now be removed from a user --- ChangeLog | 1 + share/server/core/classes/CoreModUserMgmt.php | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39c414d..931d302 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ Frontend: disabled * FIX: Disabling save button during adding new objects to prevent double adding * FIX: Roles can not be deleted when used by users + * FIX: Last assigned role can now be removed from a user 1.8b3 Frontend: diff --git a/share/server/core/classes/CoreModUserMgmt.php b/share/server/core/classes/CoreModUserMgmt.php index c42787e..853615e 100644 --- a/share/server/core/classes/CoreModUserMgmt.php +++ b/share/server/core/classes/CoreModUserMgmt.php @@ -197,21 +197,24 @@ class CoreModUserMgmt extends CoreModule { // Check for needed params if($bValid && !$this->FHANDLER->isSetAndNotEmpty('userId')) $bValid = false; - if($bValid && !$this->FHANDLER->isSetAndNotEmpty('rolesSelected')) - $bValid = false; // Regex validate if($bValid && !$this->FHANDLER->match('userId', MATCH_INTEGER)) $bValid = false; - if($bValid && !$this->FHANDLER->match('rolesSelected', MATCH_INTEGER)) + if($bValid && $this->FHANDLER->isSetAndNotEmpty('rolesSelected') + && !$this->FHANDLER->match('rolesSelected', MATCH_INTEGER)) $bValid = false; // Parse the specific options $userId = intval($this->FHANDLER->get('userId')); + $roles = $this->FHANDLER->get('rolesSelected'); + if ($roles === NULL) + $roles = array(); + // Store response data if($bValid === true) - return Array('userId' => $userId, 'roles' => $this->FHANDLER->get('rolesSelected')); + return Array('userId' => $userId, 'roles' => $roles); else return false; } |