Skip to content

Commit

Permalink
Merge pull request #3895 from IQSS/3894-setup
Browse files Browse the repository at this point in the history
don't send notification when creating dataverseAdmin user #3894
  • Loading branch information
kcondon authored Jun 13, 2017
2 parents 07f4a58 + f800e2d commit e28b927
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main/java/edu/harvard/iq/dataverse/api/BuiltinUsers.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.harvard.iq.dataverse.api;

import edu.harvard.iq.dataverse.Dataverse;
import edu.harvard.iq.dataverse.UserNotification;
import edu.harvard.iq.dataverse.actionlogging.ActionLogRecord;
import edu.harvard.iq.dataverse.authorization.UserRecordIdentifier;
Expand Down Expand Up @@ -129,9 +130,20 @@ private Response internalSave(BuiltinUser user, String password, String key) {
* @todo Move this to
* AuthenticationServiceBean.createAuthenticatedUser
*/
userNotificationSvc.sendNotification(au,
new Timestamp(new Date().getTime()),
UserNotification.Type.CREATEACC, null);
boolean rootDataversePresent = false;
try {
Dataverse rootDataverse = dataverseSvc.findRootDataverse();
if (rootDataverse != null) {
rootDataversePresent = true;
}
} catch (Exception e) {
logger.info("The root dataverse is not present. Don't send a notification to dataverseAdmin.");
}
if (rootDataversePresent) {
userNotificationSvc.sendNotification(au,
new Timestamp(new Date().getTime()),
UserNotification.Type.CREATEACC, null);
}

ApiToken token = new ApiToken();

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ public Response addDataverse( String body, @PathParam("identifier") String paren
} catch ( WrappedResponse ww ) {
Throwable cause = ww.getCause();
StringBuilder sb = new StringBuilder();
if (cause == null) {
return ww.refineResponse("cause was null!");
}
while (cause.getCause() != null) {
cause = cause.getCause();
if (cause instanceof ConstraintViolationException) {
Expand Down

0 comments on commit e28b927

Please sign in to comment.