KEYCLOAK-18280 Issues with boolean properties of executors

This commit is contained in:
mposolda 2021-05-26 09:25:35 +02:00 committed by Marek Posolda
parent bc6a746780
commit 6e139b8fda

View file

@ -3218,6 +3218,14 @@ module.controller('ClientPoliciesProfilesEditExecutorCtrl', function($scope, rea
break;
}
}
// Convert boolean properties from the configuration to strings as expected by the kc-provider-config directive
for (var j=0 ; j < $scope.executorType.properties.length ; j++) {
var currentProperty = $scope.executorType.properties[j];
if (currentProperty.type === 'boolean') {
$scope.executor.config[currentProperty.name] = ($scope.executor.config[currentProperty.name]) ? "true" : "false";
}
}
}
}
@ -3231,6 +3239,10 @@ module.controller('ClientPoliciesProfilesEditExecutorCtrl', function($scope, rea
}
}
if (configProperty.type === 'boolean') {
return (configProperty.defaultValue) ? "true" : "false";
}
if (configProperty.defaultValue !== undefined) {
return configProperty.defaultValue;
} else {
@ -3260,6 +3272,14 @@ module.controller('ClientPoliciesProfilesEditExecutorCtrl', function($scope, rea
ComponentUtils.removeLastEmptyValue($scope.executor.config);
// Convert String properties required by the kc-provider-config directive back to booleans
for (var j=0 ; j < $scope.executorType.properties.length ; j++) {
var currentProperty = $scope.executorType.properties[j];
if (currentProperty.type === 'boolean') {
$scope.executor.config[currentProperty.name] = ($scope.executor.config[currentProperty.name] === "true") ? true : false;
}
}
if ($scope.createNew) {
var selectedExecutor = {
executor: $scope.executorType.id,
@ -3580,6 +3600,14 @@ module.controller('ClientPoliciesEditConditionCtrl', function($scope, realm, ser
break;
}
}
// Convert boolean properties from the configuration to strings as expected by the kc-provider-config directive
for (var j=0 ; j < $scope.conditionType.properties.length ; j++) {
var currentProperty = $scope.conditionType.properties[j];
if (currentProperty.type === 'boolean') {
$scope.condition.config[currentProperty.name] = ($scope.condition.config[currentProperty.name]) ? "true" : "false";
}
}
}
}
@ -3593,6 +3621,10 @@ module.controller('ClientPoliciesEditConditionCtrl', function($scope, realm, ser
}
}
if (configProperty.type === 'boolean') {
return (configProperty.defaultValue) ? "true" : "false";
}
if (configProperty.defaultValue !== undefined) {
return configProperty.defaultValue;
} else {
@ -3623,6 +3655,14 @@ module.controller('ClientPoliciesEditConditionCtrl', function($scope, realm, ser
ComponentUtils.removeLastEmptyValue($scope.condition.config);
// Convert String properties required by the kc-provider-config directive back to booleans
for (var j=0 ; j < $scope.conditionType.properties.length ; j++) {
var currentProperty = $scope.conditionType.properties[j];
if (currentProperty.type === 'boolean') {
$scope.condition.config[currentProperty.name] = ($scope.condition.config[currentProperty.name] === "true") ? true : false;
}
}
var selectedCondition;
if ($scope.createNew) {
var selectedCondition = {