| | |
| | | throw new HSAdminException("domain admin required"); |
| | | } |
| | | if (!admin.getName().equals(oldDom.getUser().getName())) { |
| | | throw new AuthorisationException(loginUser, "update", existingEntity); |
| | | throw new AuthorisationException(loginUser, "update", existingEntity, "user"); |
| | | } |
| | | Query q = em.createQuery("SELECT opt FROM " + |
| | | DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() + |
| | |
| | | String aLoginUserName = loginUser.getName(); |
| | | UnixUser domUser = dom.getUser(); |
| | | Pac domPac = domUser.getPac(); |
| | | boolean isDomAdmin = aLoginUserName.equals(domUser.getName()); |
| | | boolean isPacAdmin = loginUser.hasPacAdminRoleFor(domPac); |
| | | boolean isCustomer = aLoginUserName.equals(domPac.getCustomer().getName()); |
| | | boolean isHostmaster = loginUser.hasHostmasterRole(); |
| | | if (!isPacAdmin && !isCustomer && !isHostmaster) { |
| | | if (!isDomAdmin && !"update".equals(method)) { |
| | | throw new AuthorisationException(loginUser, method, dom); |
| | | } |
| | | } |
| | | if (dom.isPacDomain() && !dom.getUser().getName().equals(domPac.getName())) { |
| | | throw new AuthorisationException(loginUser, method, dom); |
| | | } |