Skip to content

Commit

Permalink
Allow admin to move other admin via DnD from System.
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Dec 4, 2013
1 parent bbf544e commit 147c6a1
Showing 1 changed file with 22 additions and 14 deletions.
Expand Up @@ -4307,30 +4307,38 @@ public void transfer(TreeImageDisplay target, List<TreeImageDisplay> nodes,
TreeImageDisplay n;
ExperimenterData exp;
long id = model.getUserDetails().getId();
TreeImageDisplay parent;
TreeImageDisplay p;
GroupData g;
String message = null;
while (i.hasNext()) {
n = i.next();
if (n.getUserObject() instanceof ExperimenterData) {
exp = (ExperimenterData) n.getUserObject();
if (exp.getId() == id || !model.isSystemUser(exp.getId())) { //check the source
parent = n.getParentDisplay();
if (parent != null &&
parent.getUserObject() instanceof GroupData) {
g = (GroupData) parent.getUserObject();
if (model.isSystemGroup(g.getId(),
GroupData.SYSTEM)) {
p = n.getParentDisplay();
if (p != null && p.getUserObject() instanceof GroupData) {
g = (GroupData) p.getUserObject();
if (model.isSystemGroup(g.getId(),
GroupData.SYSTEM)) {
if (exp.getId() == id) {
message = "An administrator cannot remove " +
"himself/herself or root from the " +
"System group.";
"himself/herself from "+g.getName()+
" Group.";
break;
} else if (model.isSystemGroup(g.getId(),
GroupData.GUEST)) {
} else if (model.isSystemUser(exp.getId(),
GroupData.SYSTEM)) {
message = "An administrator cannot remove " +
"guest from the Guest group.";
break;
exp.getUserName()+" from "+g.getName()
+" Group.";
break;
}
} else if (model.isSystemGroup(g.getId(),
GroupData.GUEST) &&
model.isSystemUser(exp.getId(),
GroupData.GUEST)) {
message = "An administrator cannot remove " +
exp.getUserName()+" from "+g.getName()+
" Group.";
break;
}
}
}
Expand Down

0 comments on commit 147c6a1

Please sign in to comment.