| | |
| | | |
| | | @Override |
| | | public AbstractEntity add(AbstractEntity newEntity) throws HSAdminException { |
| | | EntityManager em = getTransaction().getEntityManager(); |
| | | Transaction tx = getTransaction(); |
| | | EntityManager em = tx.getEntityManager(); |
| | | EMailAddress adr = (EMailAddress) newEntity; |
| | | if (adr.getTarget() == null || adr.getTarget().length() == 0) { |
| | | throw new HSAdminException("target required"); |
| | |
| | | qDomain.setParameter("domName", adr.getDomain().getName()); |
| | | Domain dom = (Domain) qDomain.getSingleResult(); |
| | | adr.setDomain(dom); |
| | | UnixUser loginUser = tx.getLoginUser(); |
| | | if (dom.isPacDomain() && !loginUser.hasHostmasterRole()) { |
| | | throw new AuthorisationException(loginUser, "add", adr); |
| | | } |
| | | return super.add(newEntity); |
| | | } |
| | | |