KEYCLOAK-2114
This commit is contained in:
parent
067cb120f8
commit
b04b124351
5 changed files with 25 additions and 0 deletions
|
@ -24,6 +24,7 @@ module.controller('GroupListCtrl', function($scope, $route, realm, groups, Group
|
|||
$scope.paste = function(selected) {
|
||||
if (selected == null) return;
|
||||
if ($scope.cutNode == null) return;
|
||||
if (selected.id == $scope.cutNode.id) return;
|
||||
if (selected.id == 'realm') {
|
||||
Groups.save({realm: realm.realm}, {id:$scope.cutNode.id}, function() {
|
||||
$route.reload();
|
||||
|
|
|
@ -104,6 +104,9 @@ public class GroupAdapter implements GroupModel {
|
|||
@Override
|
||||
public void setParent(GroupModel parent) {
|
||||
if (parent == null) group.setParent(null);
|
||||
else if (parent.getId().equals(getId())) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
GroupEntity parentEntity = toEntity(parent, em);
|
||||
group.setParent(parentEntity);
|
||||
|
@ -112,11 +115,17 @@ public class GroupAdapter implements GroupModel {
|
|||
|
||||
@Override
|
||||
public void addChild(GroupModel subGroup) {
|
||||
if (subGroup.getId().equals(getId())) {
|
||||
return;
|
||||
}
|
||||
subGroup.setParent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeChild(GroupModel subGroup) {
|
||||
if (subGroup.getId().equals(getId())) {
|
||||
return;
|
||||
}
|
||||
subGroup.setParent(null);
|
||||
}
|
||||
|
||||
|
|
|
@ -1994,6 +1994,9 @@ public class RealmAdapter implements RealmModel {
|
|||
|
||||
@Override
|
||||
public void moveGroup(GroupModel group, GroupModel toParent) {
|
||||
if (toParent != null && group.getId().equals(toParent.getId())) {
|
||||
return;
|
||||
}
|
||||
if (group.getParentId() != null) {
|
||||
group.getParent().removeChild(group);
|
||||
}
|
||||
|
|
|
@ -223,6 +223,9 @@ public class GroupAdapter extends AbstractMongoAdapter<MongoGroupEntity> impleme
|
|||
@Override
|
||||
public void setParent(GroupModel parent) {
|
||||
if (parent == null) group.setParentId(null);
|
||||
else if (parent.getId().equals(getId())) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
group.setParentId(parent.getId());
|
||||
}
|
||||
|
@ -232,6 +235,9 @@ public class GroupAdapter extends AbstractMongoAdapter<MongoGroupEntity> impleme
|
|||
|
||||
@Override
|
||||
public void addChild(GroupModel subGroup) {
|
||||
if (subGroup.getId().equals(getId())) {
|
||||
return;
|
||||
}
|
||||
subGroup.setParent(this);
|
||||
updateGroup();
|
||||
|
||||
|
@ -239,6 +245,9 @@ public class GroupAdapter extends AbstractMongoAdapter<MongoGroupEntity> impleme
|
|||
|
||||
@Override
|
||||
public void removeChild(GroupModel subGroup) {
|
||||
if (subGroup.getId().equals(getId())) {
|
||||
return;
|
||||
}
|
||||
subGroup.setParent(null);
|
||||
updateGroup();
|
||||
|
||||
|
|
|
@ -636,6 +636,9 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
|||
|
||||
@Override
|
||||
public void moveGroup(GroupModel group, GroupModel toParent) {
|
||||
if (toParent != null && group.getId().equals(toParent.getId())) {
|
||||
return;
|
||||
}
|
||||
if (group.getParentId() != null) {
|
||||
group.getParent().removeChild(group);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue