KEYCLOAK-2621
This commit is contained in:
parent
7c9dbdfc91
commit
d35ccd9a5e
1 changed files with 23 additions and 0 deletions
|
@ -1154,6 +1154,19 @@ module.controller('UserFederationMapperCreateCtrl', function($scope, realm, prov
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function removeGroupMember(groups, member) {
|
||||||
|
for (var j = 0; j < groups.length; j++) {
|
||||||
|
//console.log('checking: ' + groups[j].path);
|
||||||
|
if (member.path == groups[j].path) {
|
||||||
|
groups.splice(j, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (groups[j].subGroups && groups[j].subGroups.length > 0) {
|
||||||
|
//console.log('going into subgroups');
|
||||||
|
removeGroupMember(groups[j].subGroups, member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
module.controller('UserGroupMembershipCtrl', function($scope, $route, realm, groups, user, UserGroupMembership, UserGroupMapping, Notifications, $location, Dialog) {
|
module.controller('UserGroupMembershipCtrl', function($scope, $route, realm, groups, user, UserGroupMembership, UserGroupMapping, Notifications, $location, Dialog) {
|
||||||
$scope.realm = realm;
|
$scope.realm = realm;
|
||||||
$scope.user = user;
|
$scope.user = user;
|
||||||
|
@ -1163,9 +1176,15 @@ module.controller('UserGroupMembershipCtrl', function($scope, $route, realm, gro
|
||||||
|
|
||||||
UserGroupMembership.query({realm: realm.realm, userId: user.id}, function(data) {
|
UserGroupMembership.query({realm: realm.realm, userId: user.id}, function(data) {
|
||||||
$scope.groupMemberships = data;
|
$scope.groupMemberships = data;
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
var member = data[i];
|
||||||
|
removeGroupMember(groups, member);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$scope.joinGroup = function() {
|
$scope.joinGroup = function() {
|
||||||
if (!$scope.tree.currentNode) {
|
if (!$scope.tree.currentNode) {
|
||||||
Notifications.error('Please select a group to add');
|
Notifications.error('Please select a group to add');
|
||||||
|
@ -1179,6 +1198,10 @@ module.controller('UserGroupMembershipCtrl', function($scope, $route, realm, gro
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.leaveGroup = function() {
|
$scope.leaveGroup = function() {
|
||||||
|
if (!$scope.selectedGroup) {
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
UserGroupMapping.remove({realm: realm.realm, userId: user.id, groupId: $scope.selectedGroup.id}, function() {
|
UserGroupMapping.remove({realm: realm.realm, userId: user.id, groupId: $scope.selectedGroup.id}, function() {
|
||||||
Notifications.success('Removed group membership');
|
Notifications.success('Removed group membership');
|
||||||
$route.reload();
|
$route.reload();
|
||||||
|
|
Loading…
Reference in a new issue