Skip most actions if pac is not a web packet.

This commit is contained in:
Michael Hierweck 2013-04-30 20:32:25 +02:00
parent ce5c545bef
commit 9b206322f0

View File

@ -86,6 +86,9 @@ public class PacModuleImpl extends AbstractModuleImpl {
pacComponents.add(pacComponent);
}
pac.setPacComponents(pacComponents);
AbstractEntity newPacEntity = null;
String pacType = pac.getBasepac().getName();
if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW) && !pacType.equals(Pac.PAC_SW)) {
Set<UnixUser> users = new HashSet<UnixUser>();
pac.setUnixUser(users);
UnixUser admin = new UnixUser();
@ -102,12 +105,15 @@ public class PacModuleImpl extends AbstractModuleImpl {
if (maxUid >= nUID) nUID = maxUid + 1;
admin.setUserId(nUID);
users.add(admin);
AbstractEntity newPacEntity = super.add(newEntity);
newPacEntity = super.add(newEntity);
GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
Domain pacDomain = new Domain();
pacDomain.setName(pac.getName() + ".hostsharing.net");
pacDomain.setUser(admin);
helperModule.add(pacDomain);
} else {
newPacEntity = super.add(newEntity);
}
return newPacEntity;
}
@ -150,6 +156,8 @@ public class PacModuleImpl extends AbstractModuleImpl {
if (dateCancelled == null || dateCancelled.getTime() > System.currentTimeMillis()) {
throw new AuthorisationException(getTransaction().getLoginUser(), "delete", existingEntity);
}
String pacType = pac.getBasepac().getName();
if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW) && !pacType.equals(Pac.PAC_SW)) {
GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
String[] dependQueries = new String[] {
@ -177,6 +185,7 @@ public class PacModuleImpl extends AbstractModuleImpl {
helperModule.delete(user);
}
}
}
super.delete(existingEntity);
}