From 9cf788c590e688b49741bdac8c9e076ced471b16 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Wed, 30 Mar 2016 15:41:46 -0400 Subject: [PATCH] KEYCLOAK-2490 --- .../admin/resources/js/controllers/realm.js | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js index e228daac5a..060f08fbff 100755 --- a/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js @@ -1829,11 +1829,28 @@ module.controller('AuthenticationFlowsCtrl', function($scope, $route, realm, flo $scope.removeFlow = function() { console.log('Remove flow:' + $scope.flow.alias); - AuthenticationFlows.remove({realm: realm.realm, flow: $scope.flow.id}, function() { - $location.url("/realms/" + realm.realm + '/authentication/flows'); - Notifications.success("Flow removed"); + if (realm.browserFlow == $scope.flow.alias) { + Notifications.error("Cannot remove flow, it is currently being used as the browser flow."); - }) + } else if (realm.registrationFlow == $scope.flow.alias) { + Notifications.error("Cannot remove flow, it is currently being used as the registration flow."); + + } else if (realm.directGrantFlow == $scope.flow.alias) { + Notifications.error("Cannot remove flow, it is currently being used as the direct grant flow."); + + } else if (realm.resetCredentialsFlow == $scope.flow.alias) { + Notifications.error("Cannot remove flow, it is currently being used as the reset credentials flow."); + + } else if (realm.clientAuthenticationFlow == $scope.flow.alias) { + Notifications.error("Cannot remove flow, it is currently being used as the client authentication flow."); + + } else { + AuthenticationFlows.remove({realm: realm.realm, flow: $scope.flow.id}, function () { + $location.url("/realms/" + realm.realm + '/authentication/flows'); + Notifications.success("Flow removed"); + + }) + } };