Enable user and group deletion. Remove dynamic Editor icon that triggered NPE on...
[lgpl/argeo-commons.git] / org.argeo.security.ui.admin / src / org / argeo / security / ui / admin / commands / NewUser.java
index 9f1ae8d0d0d37363b670c0ba250ad8c8028fb3d6..656185b73e401f0c99cbc6d440d388b2f1a240b7 100644 (file)
@@ -17,10 +17,8 @@ package org.argeo.security.ui.admin.commands;
 
 import java.util.Dictionary;
 
-import javax.transaction.Status;
 import javax.transaction.UserTransaction;
 
-import org.argeo.ArgeoException;
 import org.argeo.eclipse.ui.EclipseUiUtils;
 import org.argeo.eclipse.ui.dialogs.ErrorFeedback;
 import org.argeo.jcr.ArgeoNames;
@@ -112,17 +110,8 @@ public class NewUser extends AbstractHandler {
                        if (!canFinish())
                                return false;
                        String username = mainUserInfo.getUsername();
-
-                       // Begin transaction if needed
-                       try {
-                               if (userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION)
-                                       userTransaction.begin();
-                       } catch (Exception e) {
-                               throw new ArgeoException("Unable to start "
-                                               + "transaction to create user " + username, e);
-                       }
-
                        try {
+                               UiAdminUtils.beginTransactionIfNeeded(userTransaction);
                                char[] password = mainUserInfo.getPassword();
                                User user = (User) userAdmin.createRole(getDn(username),
                                                Role.USER);