KEYCLOAK-5932: Remove social idp from dropdown if already defined

This commit is contained in:
Stan Silvert 2017-12-14 16:32:17 -05:00
parent 97e3b26a5c
commit 2b11938084

View file

@ -860,9 +860,11 @@ module.controller('RealmIdentityProviderCtrl', function($scope, $filter, $upload
$scope.serverInfo = serverInfo; $scope.serverInfo = serverInfo;
$scope.allProviders = angular.copy(serverInfo.identityProviders); $scope.allProviders = angular.copy(serverInfo.identityProviders);
$scope.configuredProviders = angular.copy(realm.identityProviders); $scope.configuredProviders = angular.copy(realm.identityProviders);
removeUsedSocial();
$scope.authFlows = []; $scope.authFlows = [];
for (var i=0 ; i<authFlows.length ; i++) { for (var i=0 ; i<authFlows.length ; i++) {
if (authFlows[i].providerId == 'basic-flow') { if (authFlows[i].providerId == 'basic-flow') {
@ -1045,6 +1047,20 @@ module.controller('RealmIdentityProviderCtrl', function($scope, $filter, $upload
}); });
}); });
}; };
// KEYCLOAK-5932: remove social providers that have already been defined
function removeUsedSocial() {
var i = $scope.allProviders.length;
while (i--) {
if ($scope.allProviders[i].groupName !== 'Social') continue;
for (var j = 0; j < $scope.configuredProviders.length; j++) {
if ($scope.configuredProviders[j].providerId === $scope.allProviders[i].id) {
$scope.allProviders.splice(i, 1);
break;
}
}
}
};
}); });