HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2015-11-25 a0025d844be5071fb95719bd8334cfb1afcf3fcb
Merge remote-tracking branch 'origin/newweb'
19 files modified
114 ■■■■ changed files
hsarback/src/de/hsadmin/core/qserv/JDBCProcessor.java 2 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/qserv/QueueTask.java 8 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/cust/Customer.java 1 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/db/Database.java 4 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/db/DatabaseUser.java 4 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/email/EMailAddress.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/email/EMailAlias.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/pac/INetAddress.java 16 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/pac/Pac.java 17 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/user/UnixUser.java 6 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/user/UnixUserModuleImpl.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/AbstractRemote.java 4 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/ModulePropertiesRemote.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/MysqlDbRemote.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/MysqlUserRemote.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/PgsqlDbRemote.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/PgsqlUserRemote.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/PropertyRemote.java 18 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/qserv/JDBCProcessor.java
@@ -7,8 +7,6 @@
import java.util.ArrayList;
import java.util.List;
import de.hsadmin.core.qserv.AbstractProcessor;
import de.hsadmin.core.qserv.ProcessorException;
import de.hsadmin.core.util.Config;
public class JDBCProcessor extends AbstractProcessor {
hsarback/src/de/hsadmin/core/qserv/QueueTask.java
@@ -18,7 +18,9 @@
import javax.persistence.Transient;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AnnModuleImpl;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.mods.qstat.QTaskModuleImpl;
import de.hsadmin.mods.user.UnixUser;
@@ -35,26 +37,32 @@
    @Column(name = "task_id", columnDefinition = "integer")
    private long id;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @JoinColumn(name="user_id", columnDefinition="integer", nullable=true)
    @ManyToOne(fetch=FetchType.EAGER)
    private UnixUser user;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "started", columnDefinition = "date")
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date started;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "finished", columnDefinition = "date", nullable = true)
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date finished;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "title", columnDefinition = "character varying(192)")
    private String title;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "details", columnDefinition = "text", nullable = true)
    private String details;
    private Processor proc;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "exception", columnDefinition = "text", nullable = true)
    private String exception;
hsarback/src/de/hsadmin/mods/cust/Customer.java
@@ -25,7 +25,6 @@
import javax.persistence.Transient;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnModuleImpl;
import de.hsadmin.mods.pac.Pac;
import de.hsadmin.mods.user.UnixUser;
hsarback/src/de/hsadmin/mods/db/Database.java
@@ -44,7 +44,7 @@
    @Column(name = "database_id", columnDefinition = "integer", updatable=false, insertable=false)
    private long id;
    @AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.READONLY)
    @Column(name = "engine", columnDefinition = "character varying(12)", updatable=false)
    private String instance;
@@ -58,7 +58,7 @@
    @JoinColumn(name = "packet_id", columnDefinition = "integer", updatable=false)
    @ManyToOne(fetch = EAGER)
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
    private Pac pac;
    @AnnFieldIO(validation="[A-Za-z0-9\\_\\-]*", rw=ReadWriteAccess.WRITEONCE)
hsarback/src/de/hsadmin/mods/db/DatabaseUser.java
@@ -51,13 +51,13 @@
    @Transient
    private String password;
    @AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.READONLY)
    @Column(name = "engine", columnDefinition = "character varying(12)", updatable=false)
    protected String instance;
    @JoinColumn(name = "packet_id", columnDefinition = "integer", updatable=false)
    @ManyToOne(fetch = EAGER)
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
    protected Pac pac;
    protected DatabaseUser() {
hsarback/src/de/hsadmin/mods/email/EMailAddress.java
@@ -18,8 +18,8 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.AnnModuleImpl;
import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.core.model.SearchFilter;
import de.hsadmin.mods.dom.Domain;
hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java
@@ -5,9 +5,9 @@
import javax.persistence.EntityManager;
import javax.persistence.Query;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.hostsharing.BasePacType;
hsarback/src/de/hsadmin/mods/email/EMailAlias.java
@@ -45,7 +45,7 @@
    @ManyToOne()
    @JoinColumn(name = "pac_id", columnDefinition = "integer")
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
    private Pac pac;
    @AnnFieldIO(validation="[a-z0-9\\_\\-\\.\\+]*", rw=ReadWriteAccess.WRITEONCE)
hsarback/src/de/hsadmin/mods/pac/INetAddress.java
@@ -28,7 +28,7 @@
    private long id;
    @Column(name = "inet_addr", unique = true, length=-1)
    private String inetAddr;
    private String name;
    @Column(name = "description", columnDefinition = "character varying(100)")
    private String description;
@@ -37,7 +37,7 @@
    }
    public INetAddress(String inetAddr) {
        this.inetAddr = inetAddr;
        this.name = inetAddr;
    }
    public INetAddress(String inetAddr, String desc) {
@@ -68,11 +68,19 @@
    }
    public String getInetAddr() {
        return inetAddr;
        return name;
    }
    public void setInetAddr(String inetAddr) {
        this.inetAddr = inetAddr;
        this.name = inetAddr;
    }
    public String getName() {
        return name;
    }
    public void setName(String inetAddr) {
        this.name = inetAddr;
    }
    public String getDescription() {
hsarback/src/de/hsadmin/mods/pac/Pac.java
@@ -25,7 +25,9 @@
import javax.persistence.TemporalType;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AnnModuleImpl;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.mods.cust.Customer;
import de.hsadmin.mods.user.UnixUser;
@@ -46,6 +48,7 @@
    private long id;
    @Column(name = "packet_name", unique = true)
    @AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[a-z0-9]*")
    private String name;
    @JoinColumn(name = "bp_id")
@@ -54,10 +57,12 @@
    @JoinColumn(name = "basepacket_id")
    @ManyToOne(fetch = EAGER)
    private BasePac basePac;
    @AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[A-Za-z0-9\\/]*")
    private BasePac basepac;
    @JoinColumn(name = "hive_id")
    @ManyToOne(fetch = EAGER)
    @AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[a-z0-9]*")
    private Hive hive;
    @Column(name = "created")
@@ -73,6 +78,7 @@
    
    @JoinColumn(name = "cur_inet_addr_id", nullable = true)
    @ManyToOne(fetch = EAGER)
    @AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[0-9\\.]*")
    private INetAddress curINetAddr;
    @JoinColumn(name = "old_inet_addr_id", nullable = true)
@@ -83,16 +89,17 @@
    private Set<PacComponent> pacComponents;
    @OneToMany(fetch = LAZY, cascade = ALL, mappedBy="pac")
    @AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[a-z0-9\\-\\.\\_]*")
    private Set<UnixUser> unixUser;
    public void initPacComponents(EntityManager em, BasePac aBasepac, boolean setDefaults) {
        Query qAttachedBasepac = em.createQuery("SELECT b FROM BasePacs b WHERE b.valid = :valid AND b.name = :name");
        qAttachedBasepac.setParameter("valid", Boolean.TRUE);
        qAttachedBasepac.setParameter("name", aBasepac.getName());
        basePac = (BasePac) qAttachedBasepac.getSingleResult();
        basepac = (BasePac) qAttachedBasepac.getSingleResult();
        pacComponents = new HashSet<PacComponent>();
        Date today = new Date();
        for (Component comp : basePac.getComponents()) {
        for (Component comp : basepac.getComponents()) {
            PacComponent pacComp = new PacComponent();
            pacComp.setCreated(today);
            pacComp.setBaseComponent(comp.getBaseComponent());
@@ -193,11 +200,11 @@
    }
    public BasePac getBasepac() {
        return basePac;
        return basepac;
    }
    public void setBasepac(BasePac basepac) {
        this.basePac = basepac;
        this.basepac = basepac;
    }
    public Set<PacComponent> getPacComponents() {
hsarback/src/de/hsadmin/mods/user/UnixUser.java
@@ -48,7 +48,7 @@
    @Transient
    private String password;
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
    @JoinColumn(name = "packet_id", columnDefinition = "integer", updatable=false)
    @ManyToOne(fetch = FetchType.LAZY)
    private Pac pac;
@@ -61,11 +61,11 @@
    @Column(name = "shell", columnDefinition = "character varying(32)")
    private String shell;
    @AnnFieldIO(validation="[a-z0-9\\/\\_\\-\\.]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-z0-9\\/\\_\\-\\.]*", rw=ReadWriteAccess.READONLY)
    @Column(name = "homedir", columnDefinition = "character varying(48)", updatable=false)
    private String homedir;
    @AnnFieldIO(rw=ReadWriteAccess.READWRITE)
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "locked", columnDefinition = "boolean")
    private boolean locked;
hsarback/src/de/hsadmin/mods/user/UnixUserModuleImpl.java
@@ -6,9 +6,9 @@
import javax.persistence.EntityManager;
import javax.persistence.Query;
import de.hsadmin.core.model.AuthorisationException;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.hostsharing.BasePacType;
hsarback/src/de/hsadmin/remote/AbstractRemote.java
@@ -21,6 +21,10 @@
    protected abstract Class<? extends AbstractEntity> getEntityClass();
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return getEntityClass();
    }
    protected abstract void entity2map(Transaction tx, AbstractEntity entity, Map<String, Object> resultMap);
    protected abstract void map2entity(Transaction tx, Map<String, Object> setParams, AbstractEntity entity) throws HSAdminException;
hsarback/src/de/hsadmin/remote/ModulePropertiesRemote.java
@@ -13,10 +13,10 @@
import de.hsadmin.core.model.AuthenticationException;
import de.hsadmin.core.model.DefaultSelectableValues;
import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.KindOfSelectableValue;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.core.model.SelectableValue;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.model.KindOfSelectableValue;
public class ModulePropertiesRemote implements IRemote {
hsarback/src/de/hsadmin/remote/MysqlDbRemote.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.mods.db.Database;
import de.hsadmin.mods.db.MySqlDatabase;
public class MysqlDbRemote extends AbstractRemote {
@@ -28,6 +29,11 @@
    }
    @Override
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return Database.class;
    }
    @Override
    protected Class<? extends AbstractEntity> getEntityClass() {
        return MySqlDatabase.class;
    }
hsarback/src/de/hsadmin/remote/MysqlUserRemote.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.mods.db.DatabaseUser;
import de.hsadmin.mods.db.MySqlUser;
public class MysqlUserRemote extends AbstractRemote {
@@ -24,6 +25,11 @@
    }
    @Override
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return DatabaseUser.class;
    }
    @Override
    protected Class<? extends AbstractEntity> getEntityClass() {
        return MySqlUser.class;
    }
hsarback/src/de/hsadmin/remote/PgsqlDbRemote.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.mods.db.Database;
import de.hsadmin.mods.db.PgSqlDatabase;
public class PgsqlDbRemote extends AbstractRemote {
@@ -28,6 +29,11 @@
    }
    @Override
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return Database.class;
    }
    @Override
    protected Class<? extends AbstractEntity> getEntityClass() {
        return PgSqlDatabase.class;
    }
hsarback/src/de/hsadmin/remote/PgsqlUserRemote.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.mods.db.DatabaseUser;
import de.hsadmin.mods.db.PgSqlUser;
public class PgsqlUserRemote extends AbstractRemote {
@@ -24,6 +25,11 @@
    }
    @Override
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return DatabaseUser.class;
    }
    @Override
    protected Class<? extends AbstractEntity> getEntityClass() {
        return PgSqlUser.class;
    }
hsarback/src/de/hsadmin/remote/PropertyRemote.java
@@ -22,6 +22,7 @@
            Map<String, String> whereParams) throws HSAdminException {
        String user = runAsUser;
        List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
        addRolesModule(result);
        Transaction transaction = new Transaction(user);
        try {
            if (transaction.login(user, ticket)) {
@@ -33,7 +34,7 @@
                    Object newInstance = remoteClass.newInstance();
                    if (newInstance instanceof AbstractRemote) {
                        AbstractRemote remote = (AbstractRemote) newInstance;
                        Class<? extends AbstractEntity> entityClass = remote.getEntityClass();
                        Class<? extends AbstractEntity> entityClass = remote.getAnnotatedEntityClass();
                        for (Field f: entityClass.getDeclaredFields()) {
                            AnnFieldIO fieldIO = f.getAnnotation(AnnFieldIO.class);
                            if (fieldIO != null) {
@@ -82,6 +83,21 @@
        }
    }
    private void addRolesModule(final List<Map<String, Object>> result) {
        final HashMap<String, Object> propertyProperties = new HashMap<String, Object>();
        propertyProperties.put("module", "role");
        propertyProperties.put("name", "role");
        propertyProperties.put("searchable", "equals");
        propertyProperties.put("readwriteable", "read");
        propertyProperties.put("type", "string");
        propertyProperties.put("displaySequence", "1");
        propertyProperties.put("displayVisible", "always");
        propertyProperties.put("minLength", "0");
        propertyProperties.put("maxLength", "20");
        propertyProperties.put("validationRegexp", "[A-Z_]*");
        result.add(propertyProperties);
    }
    @Override
    public Map<String, Object> add(String runAsUser, String ticket,
            Map<String, Object> setParams) throws HSAdminException {