[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());
|
||||
|
||||
assertPolicy(expected, actual);
|
||||
|
||||
expected.setNotBefore("");
|
||||
expected.setNotOnOrAfter("");
|
||||
|
||||
authorizationPage.navigateTo();
|
||||
authorizationPage.authorizationTabs().policies().update(expected.getName(), expected);
|
||||
assertAlertSuccess();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1985,6 +1985,16 @@ module.controller('ResourceServerPolicyJSDetailCtrl', function($scope, $route, $
|
|||
});
|
||||
|
||||
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({
|
||||
getPolicyType : function() {
|
||||
return "time";
|
||||
|
@ -2028,6 +2038,7 @@ module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route,
|
|||
},
|
||||
|
||||
onUpdate : function() {
|
||||
clearEmptyStrings();
|
||||
delete $scope.policy.config;
|
||||
},
|
||||
|
||||
|
@ -2035,6 +2046,7 @@ module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route,
|
|||
},
|
||||
|
||||
onCreate : function() {
|
||||
clearEmptyStrings();
|
||||
delete $scope.policy.config;
|
||||
}
|
||||
}, realm, client, $scope);
|
||||
|
|
Loading…
Reference in a new issue