[KEYCLOAK-17588] - Authz confirmation popping out twice

This commit is contained in:
Pedro Igor 2021-05-12 14:10:50 -03:00
parent 927c359693
commit 62e17f3be7
3 changed files with 12 additions and 8 deletions

View file

@ -41,7 +41,6 @@ public class DisableAuthorizationSettingsTest extends AbstractAuthorizationSetti
clientSettingsPage.form().save();
}, 10, 300);
clientSettingsPage.form().confirmDisableAuthorizationSettings();
Retry.execute(this::assertAlertSuccess, 10, 300);
clientSettingsPage.navigateTo();

View file

@ -1577,6 +1577,17 @@ module.controller('ClientDetailCtrl', function($scope, realm, client, flows, $ro
}
}
$scope.confirmChangeAuthzSettings = function($event) {
if ($scope.client.authorizationServicesEnabled && $scope.clientEdit.authorizationServicesEnabled) {
$event.preventDefault();
Dialog.confirm("Disable Authorization Settings", "Are you sure you want to disable authorization ? Once you save your changes, all authorization settings associated with this client will be removed. This operation can not be reverted.", function () {
$scope.clientEdit.authorizationServicesEnabled = false;
}, function () {
$scope.clientEdit.authorizationServicesEnabled = true;
});
}
}
function configureAuthorizationServices() {
if ($scope.clientEdit.authorizationServicesEnabled) {
if ($scope.accessType == 'public') {
@ -1587,12 +1598,6 @@ module.controller('ClientDetailCtrl', function($scope, realm, client, flows, $ro
} else if ($scope.clientEdit.bearerOnly) {
$scope.clientEdit.serviceAccountsEnabled = false;
}
if ($scope.client.authorizationServicesEnabled && !$scope.clientEdit.authorizationServicesEnabled) {
Dialog.confirm("Disable Authorization Settings", "Are you sure you want to disable authorization ? Once you save your changes, all authorization settings associated with this client will be removed. This operation can not be reverted.", function () {
}, function () {
$scope.clientEdit.authorizationServicesEnabled = true;
});
}
}
$scope.$watch('clientEdit', function() {

View file

@ -165,7 +165,7 @@
<label class="col-md-2 control-label" for="authorizationServicesEnabled">{{:: 'authz-authorization-services-enabled' | translate}}</label>
<kc-tooltip>{{:: 'authz-authorization-services-enabled.tooltip' | translate}}</kc-tooltip>
<div class="col-md-6">
<input ng-model="clientEdit.authorizationServicesEnabled" name="authorizationServicesEnabled" id="authorizationServicesEnabled" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
<input ng-model="clientEdit.authorizationServicesEnabled" ng-click="confirmChangeAuthzSettings($event)" name="authorizationServicesEnabled" id="authorizationServicesEnabled" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
</div>
</div>
<div class="form-group clearfix block" data-ng-show="protocol == 'saml'">