move basepac names to hostsharing package
1 files added
16 files modified
New file |
| | |
| | | package de.hsadmin.hostsharing; |
| | | |
| | | public class BasePacType { |
| | | |
| | | public static final String PAC_DW = "PAC/DW"; |
| | | public static final String PAC_SW = "PAC/SW"; |
| | | public static final String PAC_WEB = "PAC/WEB"; |
| | | public static final String PAC_SRV = "SRV/MGD"; |
| | | |
| | | } |
| | |
| | | import de.hsadmin.core.model.AuthorisationException; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.core.model.Transaction; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.hostsharing.MultiOption; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | |
| | | } |
| | | //TODO: Needs better implementation |
| | | String pacType = pac.getBasepac().getName(); |
| | | if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW)) { |
| | | if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW)) { |
| | | throw new HSAdminException("not allowed for this packet type"); |
| | | } |
| | | //TODO: Needs better implementation |
| | |
| | | import de.hsadmin.core.model.AuthorisationException; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.core.model.Transaction; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.hostsharing.MultiOption; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | |
| | | } |
| | | //TODO: Needs better implementation |
| | | String pacType = pac.getBasepac().getName(); |
| | | if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW)) { |
| | | if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW)) { |
| | | throw new HSAdminException("not allowed for this packet type"); |
| | | } |
| | | //TODO: Needs better implementation |
| | |
| | | import de.hsadmin.core.model.AuthorisationException; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.core.model.Transaction; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.hostsharing.MultiOption; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | |
| | | } |
| | | //TODO: Needs better implementation |
| | | String pacType = pac.getBasepac().getName(); |
| | | if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW)) { |
| | | if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW)) { |
| | | throw new HSAdminException("not allowed for this packet type"); |
| | | } |
| | | //TODO: Needs better implementation |
| | |
| | | import de.hsadmin.core.model.AbstractModuleImpl; |
| | | import de.hsadmin.core.model.AuthorisationException; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.hostsharing.MultiOption; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | |
| | | } |
| | | //TODO: Needs better implementation |
| | | String pacType = pac.getBasepac().getName(); |
| | | if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW)) { |
| | | if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW)) { |
| | | throw new HSAdminException("not allowed for this packet type"); |
| | | } |
| | | //TODO: Needs better implementation |
| | |
| | | import de.hsadmin.core.model.AnnFieldIO; |
| | | import de.hsadmin.core.model.AnnModuleImpl; |
| | | import de.hsadmin.core.model.ReadWriteAccess; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | | |
| | | @Entity(name = "Domains") |
| | |
| | | |
| | | public boolean isDynamic() { |
| | | String basepacName = getUser().getPac().getBasepac().getName(); |
| | | return isPacDomain() || basepacName.equals(Pac.PAC_DW) || basepacName.equals(Pac.PAC_WEB); |
| | | return isPacDomain() || basepacName.equals(BasePacType.PAC_DW) || basepacName.equals(BasePacType.PAC_WEB); |
| | | } |
| | | |
| | | public boolean isStatic() { |
| | |
| | | import de.hsadmin.core.model.AbstractModuleImpl; |
| | | import de.hsadmin.core.model.AuthorisationException; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.mods.email.EMailAddress; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | |
| | | admin = (UnixUser) userQuery.getSingleResult(); |
| | | //TODO: Needs better implementation |
| | | String pacType = admin.getPac().getBasepac().getName(); |
| | | if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW) && !pacType.equals(Pac.PAC_SW)) { |
| | | if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW) && !pacType.equals(BasePacType.PAC_SW)) { |
| | | throw new HSAdminException("not allowed for this packet type"); |
| | | } |
| | | // Standard domainoptions setzen. TODO: Alle defaults über eigene Klasse aus der Datenbank holen. |
| | |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.core.model.Transaction; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.mods.dom.Domain; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | | |
| | | public class EMailAddressModuleImpl extends AbstractModuleImpl { |
| | |
| | | } |
| | | //TODO: Needs better implementation |
| | | String pacType = dom.getUser().getPac().getBasepac().getName(); |
| | | if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW) && !pacType.equals(Pac.PAC_SW)) { |
| | | if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW) && !pacType.equals(BasePacType.PAC_SW)) { |
| | | throw new HSAdminException("not allowed for this packet type"); |
| | | } |
| | | //TODO: Needs better implementation |
| | |
| | | import de.hsadmin.core.model.AuthorisationException; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.core.model.Transaction; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.hostsharing.MultiOption; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | |
| | | } |
| | | //TODO: Needs better implementation |
| | | String pacType = pac.getBasepac().getName(); |
| | | if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW) && !pacType.equals(Pac.PAC_SW)) { |
| | | if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW) && !pacType.equals(BasePacType.PAC_SW)) { |
| | | throw new HSAdminException("not allowed for this packet type"); |
| | | } |
| | | //TODO: Needs better implementation |
| | |
| | | |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | | import de.hsadmin.core.model.AnnModuleImpl; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.mods.cust.Customer; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | | |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public static final int UNDEFINED_QUANTITY = -1; |
| | | |
| | | public static final String PAC_DW = "PAC/DW"; |
| | | public static final String PAC_SW = "PAC/SW"; |
| | | public static final String PAC_WEB = "PAC/WEB"; |
| | | public static final String PAC_SRV = "SRV/MGD"; |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = SEQUENCE, generator = "PacsSeqGen") |
| | |
| | | |
| | | public boolean isDynamic() { |
| | | String basepacName = getBasepac().getName(); |
| | | return PAC_DW.equals(basepacName) || PAC_WEB.equals(basepacName); |
| | | return BasePacType.PAC_DW.equals(basepacName) || BasePacType.PAC_WEB.equals(basepacName); |
| | | } |
| | | |
| | | public boolean isManagedServer() { |
| | | String basepacName = getBasepac().getName(); |
| | | return PAC_SRV.equals(basepacName); |
| | | return BasePacType.PAC_SRV.equals(basepacName); |
| | | } |
| | | } |
| | |
| | | import de.hsadmin.core.model.GenericModuleImpl; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.core.util.TextUtil; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.mods.cust.Contact; |
| | | import de.hsadmin.mods.cust.Customer; |
| | | import de.hsadmin.mods.dom.Domain; |
| | |
| | | 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)) { |
| | | if (pacType.equals(BasePacType.PAC_WEB) || pacType.equals(BasePacType.PAC_DW) || pacType.equals(BasePacType.PAC_SW)) { |
| | | Set<UnixUser> users = new HashSet<UnixUser>(); |
| | | pac.setUnixUser(users); |
| | | UnixUser admin = new UnixUser(); |
| | |
| | | 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)) { |
| | | if (pacType.equals(BasePacType.PAC_WEB) || pacType.equals(BasePacType.PAC_DW) || pacType.equals(BasePacType.PAC_SW)) { |
| | | GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction()); |
| | | |
| | | String[] dependQueries = new String[] { |
| | |
| | | import de.hsadmin.core.qserv.VelocityProcessor; |
| | | import de.hsadmin.core.qserv.WaitingTasksProcessor; |
| | | import de.hsadmin.core.util.PasswordTool; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | | |
| | | |
| | |
| | | EntityManager em, T entity) throws ProcessorException { |
| | | Pac pac = (Pac) entity; |
| | | String basepacName = pac.getBasepac().getName(); |
| | | if (basepacName.equals(Pac.PAC_WEB) || basepacName.equals(Pac.PAC_DW) || basepacName.equals(Pac.PAC_SW)) { |
| | | if (basepacName.equals(BasePacType.PAC_WEB) || basepacName.equals(BasePacType.PAC_DW) || basepacName.equals(BasePacType.PAC_SW)) { |
| | | String pacName = pac.getName(); |
| | | Hive hive = pac.getHive(); |
| | | UnixUser unixUser = getPacAdminUser(pac); |
| | |
| | | throws ProcessorException { |
| | | Pac pac = (Pac) entity; |
| | | String basepacName = pac.getBasepac().getName(); |
| | | if (basepacName.equals(Pac.PAC_WEB) || basepacName.equals(Pac.PAC_DW) || basepacName.equals(Pac.PAC_SW)) { |
| | | if (basepacName.equals(BasePacType.PAC_WEB) || basepacName.equals(BasePacType.PAC_DW) || basepacName.equals(BasePacType.PAC_SW)) { |
| | | return createSetQuotaProc(pac); |
| | | } else { |
| | | return new NullProcessor(); |
| | |
| | | public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException { |
| | | Pac pac = (Pac) entity; |
| | | String basepacName = pac.getBasepac().getName(); |
| | | if (basepacName.equals(Pac.PAC_WEB) || basepacName.equals(Pac.PAC_DW) || basepacName.equals(Pac.PAC_SW)) { |
| | | if (basepacName.equals(BasePacType.PAC_WEB) || basepacName.equals(BasePacType.PAC_DW) || basepacName.equals(BasePacType.PAC_SW)) { |
| | | Hive hive = pac.getHive(); |
| | | WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName())); |
| | | waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor( |
| | |
| | | import de.hsadmin.core.model.AbstractModuleImpl; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.core.model.Transaction; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | import de.hsadmin.hostsharing.MultiOption; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | |
| | |
| | | } |
| | | //TODO: Needs better implementation |
| | | String pacType = pac.getBasepac().getName(); |
| | | if (!pacType.equals(Pac.PAC_WEB) && !pacType.equals(Pac.PAC_DW) && !pacType.equals(Pac.PAC_SW)) { |
| | | if (!pacType.equals(BasePacType.PAC_WEB) && !pacType.equals(BasePacType.PAC_DW) && !pacType.equals(BasePacType.PAC_SW)) { |
| | | throw new HSAdminException("not allowed for this packet type"); |
| | | } |
| | | //TODO: Needs better implementation |
| | |
| | | import org.junit.Before; |
| | | import org.junit.Test; |
| | | |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | |
| | | public class InitDataTest { |
| | | |
| | |
| | | setParams.put("name", "aaa00"); |
| | | setParams.put("hive", "h99"); |
| | | setParams.put("customer", "hsh00-aaa"); |
| | | setParams.put("basepac", Pac.PAC_WEB); |
| | | setParams.put("basepac", BasePacType.PAC_WEB); |
| | | setParams.put("curinetaddr", "176.9.242.74"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | |
| | | import org.junit.Test; |
| | | |
| | | import de.hsadmin.core.util.Config; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | |
| | | public class PacMigrationTest { |
| | | |
| | |
| | | setParams.put("name", "aaa04"); |
| | | setParams.put("hive", "h99"); |
| | | setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa"); |
| | | setParams.put("basepac", Pac.PAC_DW); |
| | | setParams.put("basepac", BasePacType.PAC_DW); |
| | | setParams.put("curinetaddr", "176.9.242.77"); |
| | | HashMap<String, String> components = new HashMap<String, String>(); |
| | | components.put("QUOTA", "640"); |
| | |
| | | assertTrue(untypedResultArray[0] instanceof Map<?,?>); |
| | | @SuppressWarnings("unchecked") |
| | | Map<String, ?> pacResultMap = (Map<String, ?>) untypedResultArray[0]; |
| | | assertEquals(Pac.PAC_DW, pacResultMap.get("basepac")); |
| | | assertEquals(BasePacType.PAC_DW, pacResultMap.get("basepac")); |
| | | Object compMapObj = pacResultMap.get("components"); |
| | | assertTrue(compMapObj instanceof Map<?,?>); |
| | | @SuppressWarnings("unchecked") |
| | |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, Object> setParams = new HashMap<String, Object>(); |
| | | Map<String, String> components = new HashMap<String, String>(); |
| | | setParams.put("basepac", Pac.PAC_WEB); |
| | | setParams.put("basepac", BasePacType.PAC_WEB); |
| | | setParams.put("components", components); |
| | | // components.put("QUOTA", "2048"); // does not work till now |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | |
| | | assertTrue(untypedResultArray[0] instanceof Map<?,?>); |
| | | @SuppressWarnings("unchecked") |
| | | Map<String, ?> pacResultMap = (Map<String, ?>) untypedResultArray[0]; |
| | | assertEquals(Pac.PAC_WEB, pacResultMap.get("basepac")); |
| | | assertEquals(BasePacType.PAC_WEB, pacResultMap.get("basepac")); |
| | | Object compMapObj = pacResultMap.get("components"); |
| | | assertTrue(compMapObj instanceof Map<?,?>); |
| | | @SuppressWarnings("unchecked") |
| | |
| | | import org.junit.Test; |
| | | |
| | | import de.hsadmin.core.util.Config; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | |
| | | public class PacTest { |
| | | |
| | |
| | | assertTrue(untypedResultArray[0] instanceof Map<?,?>); |
| | | @SuppressWarnings("unchecked") |
| | | Map<String, ?> pacResultMap = (Map<String, ?>) untypedResultArray[0]; |
| | | assertEquals(Pac.PAC_WEB, pacResultMap.get("basepac")); |
| | | assertEquals(BasePacType.PAC_WEB, pacResultMap.get("basepac")); |
| | | Object compMapObj = pacResultMap.get("components"); |
| | | assertTrue(compMapObj instanceof Map<?,?>); |
| | | @SuppressWarnings("unchecked") |
| | |
| | | setParams.put("name", "aaa01"); |
| | | setParams.put("hive", "h99"); |
| | | setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa"); |
| | | setParams.put("basepac", Pac.PAC_WEB); |
| | | setParams.put("basepac", BasePacType.PAC_WEB); |
| | | setParams.put("curinetaddr", "176.9.242.76"); |
| | | HashMap<String, String> components = new HashMap<String, String>(); |
| | | components.put("QUOTA", "512"); |
| | |
| | | setParams.put("name", "aaa90"); |
| | | setParams.put("hive", "h99"); |
| | | setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa"); |
| | | setParams.put("basepac", Pac.PAC_SRV); |
| | | setParams.put("basepac", BasePacType.PAC_SRV); |
| | | setParams.put("curinetaddr", "176.9.242.76"); |
| | | setParams.put("free", "true"); |
| | | Object[] params = new Object[] { user, |
| | |
| | | import de.hsadmin.core.qserv.CommandShell; |
| | | import de.hsadmin.core.qserv.ShellException; |
| | | import de.hsadmin.core.util.Config; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | import de.hsadmin.hostsharing.BasePacType; |
| | | |
| | | public class SSLCertDomainTest { |
| | | |
| | |
| | | setParams.put("name", "aaa02"); |
| | | setParams.put("hive", "h99"); |
| | | setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa"); |
| | | setParams.put("basepac", Pac.PAC_WEB); |
| | | setParams.put("basepac", BasePacType.PAC_WEB); |
| | | setParams.put("curinetaddr", "176.9.242.77"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | |
| | | setParams.put("name", "aaa03"); |
| | | setParams.put("hive", "h99"); |
| | | setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa"); |
| | | setParams.put("basepac", Pac.PAC_DW); |
| | | setParams.put("basepac", BasePacType.PAC_DW); |
| | | setParams.put("curinetaddr", "176.9.242.78"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |