[KEYCLOAK-8270] - Cannot remove 'Not Before' or 'Not On or After' from a Time Policy
This commit is contained in:
parent
6b0bc0b3be
commit
39f0e4528a
2 changed files with 19 additions and 0 deletions
|
@ -77,6 +77,13 @@ public class TimePolicyManagementTest extends AbstractAuthorizationSettingsTest
|
||||||
TimePolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
|
TimePolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
|
||||||
|
|
||||||
assertPolicy(expected, actual);
|
assertPolicy(expected, actual);
|
||||||
|
|
||||||
|
expected.setNotBefore("");
|
||||||
|
expected.setNotOnOrAfter("");
|
||||||
|
|
||||||
|
authorizationPage.navigateTo();
|
||||||
|
authorizationPage.authorizationTabs().policies().update(expected.getName(), expected);
|
||||||
|
assertAlertSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1985,6 +1985,16 @@ module.controller('ResourceServerPolicyJSDetailCtrl', function($scope, $route, $
|
||||||
});
|
});
|
||||||
|
|
||||||
module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route, $location, realm, PolicyController, client) {
|
module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route, $location, realm, PolicyController, client) {
|
||||||
|
|
||||||
|
function clearEmptyStrings() {
|
||||||
|
if ($scope.policy.notBefore != undefined && $scope.policy.notBefore.trim() == '') {
|
||||||
|
$scope.policy.notBefore = null;
|
||||||
|
}
|
||||||
|
if ($scope.policy.notOnOrAfter != undefined && $scope.policy.notOnOrAfter.trim() == '') {
|
||||||
|
$scope.policy.notOnOrAfter = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PolicyController.onInit({
|
PolicyController.onInit({
|
||||||
getPolicyType : function() {
|
getPolicyType : function() {
|
||||||
return "time";
|
return "time";
|
||||||
|
@ -2028,6 +2038,7 @@ module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route,
|
||||||
},
|
},
|
||||||
|
|
||||||
onUpdate : function() {
|
onUpdate : function() {
|
||||||
|
clearEmptyStrings();
|
||||||
delete $scope.policy.config;
|
delete $scope.policy.config;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2035,6 +2046,7 @@ module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route,
|
||||||
},
|
},
|
||||||
|
|
||||||
onCreate : function() {
|
onCreate : function() {
|
||||||
|
clearEmptyStrings();
|
||||||
delete $scope.policy.config;
|
delete $scope.policy.config;
|
||||||
}
|
}
|
||||||
}, realm, client, $scope);
|
}, realm, client, $scope);
|
||||||
|
|
Loading…
Reference in a new issue