From ef5866f9168c7ee3f5f63f8b33ceb8078d81387a Mon Sep 17 00:00:00 2001 From: Robert Anderson <randerson@lbsd.net> Date: Mon, 12 Oct 2009 08:27:58 +0000 Subject: [PATCH] Cannot add wisp user attributes without at least three values (name, operator, value) --- webgui/include/ajax/functions/WiSPUsers.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/webgui/include/ajax/functions/WiSPUsers.php b/webgui/include/ajax/functions/WiSPUsers.php index cac8ea8a..d1935b23 100644 --- a/webgui/include/ajax/functions/WiSPUsers.php +++ b/webgui/include/ajax/functions/WiSPUsers.php @@ -363,7 +363,11 @@ function createWiSPUser($params) { foreach ($params[0]['Attributes'] as $attr) { # We only want to add attributes with all values - if (isset($attr['Name']) && isset($attr['Operator']) && isset($attr['Value'])) { + $boolName = (isset($attr['Name']) && $attr['Name'] != ""); + $boolOperator = (isset($attr['Operator']) && $attr['Operator'] != ""); + $boolValue = (isset($attr['Value']) && $attr['Value'] != ""); + if (($boolName && $boolOperator && $boolValue) == TRUE) { + # Default value without modifier $attrValue = $attr['Value']; @@ -498,7 +502,11 @@ function createWiSPUser($params) { if ($res !== FALSE && count($params[0]['Attributes']) > 0) { foreach ($params[0]['Attributes'] as $attr) { - if (isset($attr['Name']) && isset($attr['Operator']) && isset($attr['Value'])) { + # We only want to add attributes with all values + $boolName = (isset($attr['Name']) && $attr['Name'] != ""); + $boolOperator = (isset($attr['Operator']) && $attr['Operator'] != ""); + $boolValue = (isset($attr['Value']) && $attr['Value'] != ""); + if (($boolName && $boolOperator && $boolValue) == TRUE) { # Default value without modifier $attrValue = $attr['Value']; @@ -707,7 +715,11 @@ function updateWiSPUser($params) { if ($res !== FALSE && count($params[0]['Attributes']) > 0) { foreach ($params[0]['Attributes'] as $attr) { - if (isset($attr['ID']) && isset($attr['Name']) && isset($attr['Operator']) && isset($attr['Value'])) { + # We only want to add attributes with all values + $boolName = (isset($attr['Name']) && $attr['Name'] != ""); + $boolOperator = (isset($attr['Operator']) && $attr['Operator'] != ""); + $boolValue = (isset($attr['Value']) && $attr['Value'] != ""); + if (($boolName && $boolOperator && $boolValue) == TRUE) { # Default value without modifier $attrValue = $attr['Value']; -- GitLab