delete pac domains
This commit is contained in:
parent
8ae17912b7
commit
8c7363cb14
@ -119,6 +119,7 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
||||
public void delete(AbstractEntity existingEntity) throws HSAdminException {
|
||||
EntityManager em = getTransaction().getEntityManager();
|
||||
Pac pac = (Pac) existingEntity;
|
||||
String pacName = pac.getName();
|
||||
Date dateCancelled = pac.getCancelled();
|
||||
if (dateCancelled == null || dateCancelled.getTime() > System.currentTimeMillis()) {
|
||||
throw new AuthorisationException(getLoginUser(), "delete", existingEntity);
|
||||
@ -126,7 +127,7 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
||||
GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
|
||||
|
||||
Query qDoms = em.createQuery("SELECT dom FROM Domains dom WHERE dom.user.pac.name = :pac");
|
||||
qDoms.setParameter("pac", pac.getName());
|
||||
qDoms.setParameter("pac", pacName);
|
||||
List<?> domsList = qDoms.getResultList();
|
||||
for (Object o : domsList) {
|
||||
if (o instanceof Domain) {
|
||||
@ -134,9 +135,8 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
||||
}
|
||||
}
|
||||
|
||||
UnixUser admin = pac.owningUser(em);
|
||||
for (UnixUser user : pac.getUnixUser()) {
|
||||
if (admin.getId() != user.getId()) {
|
||||
if (!pacName.equals(user.getName())) {
|
||||
helperModule.delete(user);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user