Skip to content

Commit

Permalink
ensure unique user registry nodes in admin tree
Browse files Browse the repository at this point in the history
  • Loading branch information
twagoo committed Feb 6, 2020
1 parent 5458dfc commit 7f00472
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

import javax.xml.bind.JAXBException;
import javax.xml.transform.TransformerException;
import org.apache.wicket.util.lang.Objects;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -846,8 +847,12 @@ public String getName() {
}
}
};
Optional<RegistryUser> u = userDao.findById(getUserId().longValue());
return "Registry of " + u.map(RegistryUser::getName).orElse("USER NOT FOUND");

final Optional<RegistryUser> u = userDao.findById(getUserId().longValue());
return "Registry of "
+ u
.map(ru -> Objects.equal(ru.getName(), ru.getPrincipalName()) ? ru.getName() : String.format("%s (%s)", ru.getName(), ru.getPrincipalName()))
.orElse("USER NOT FOUND");
}

@Override
Expand Down Expand Up @@ -925,7 +930,6 @@ public void deleteComment(String commentId) throws IOException,

// Comment must have an existing (in this registry)
// componentId or profileId

this.checkAuthorisationComment(comment);
commentsDao.delete(comment);
} else {
Expand Down

0 comments on commit 7f00472

Please sign in to comment.