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

@ -863,6 +863,8 @@ module.controller('RealmIdentityProviderCtrl', function($scope, $filter, $upload
$scope.configuredProviders = angular.copy(realm.identityProviders);
removeUsedSocial();
$scope.authFlows = [];
for (var i=0 ; i<authFlows.length ; i++) {
if (authFlows[i].providerId == 'basic-flow') {
@ -1046,6 +1048,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;
}
}
}
};
});
module.controller('RealmIdentityProviderExportCtrl', function(realm, identityProvider, $scope, $http, IdentityProviderExport) {