HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2011-05-17 696fd165feefdb8af04224664f8e2f64437b88d5
resolve #20, #25, #27
2 files modified
31 ■■■■ changed files
hsarback/src/de/hsadmin/cliClientConnector/CLIClientConnectorServlet.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/user/UnixUserProcessorFactory.java 29 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/cliClientConnector/CLIClientConnectorServlet.java
@@ -35,7 +35,7 @@
public class CLIClientConnectorServlet extends HttpServlet {
    
    private static final long serialVersionUID = 7150004719303750077L;
    public static final String version = "1.0.9 (2010/Oct/05 18:34)";
    public static final String version = "CLI Servlet 2.0.0 (2011/May/21 09:00 MEST)";
    
    private Map<String, Class<?>> componentmap;
    private Map<String, String> componentDescriptions;
hsarback/src/de/hsadmin/mods/user/UnixUserProcessorFactory.java
@@ -1,8 +1,5 @@
package de.hsadmin.mods.user;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.EntityManager;
import de.hsadmin.core.model.AbstractEntity;
@@ -55,18 +52,22 @@
    /**
     *  @return a Processor which deletes an existing UNIX user account
     */
    public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em,
            T entity) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyMMdd-HHmm-");
        String trashPrefix = "/home/trash/" + sdf.format(new Date());
    public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) {
        UnixUser user = (UnixUser) entity;
        CompoundProcessor aCP = new CompoundProcessor();
        if (user.isDefaultHomedir())
            aCP.appendProcessor(new ShellProcessor("mv '" + user.getHomedir()
                    + "' '" + trashPrefix + user.getName() + "'"));
        aCP.appendProcessor(new ShellProcessor("userdel " + user.getName()));
        return aCP;
        String uid = user.getName();
        if (uid != null && uid.length() > 4) {
            Processor userdelProc = null;
            if (user.isDefaultHomedir()) {
                userdelProc = new ShellProcessor("userdel " + uid + " && rm -rf '" + user.getHomedir() + "'");
            } else {
                userdelProc = new ShellProcessor("userdel " + uid);
            }
            CompoundProcessor proc = new CompoundProcessor(userdelProc);
            proc.appendProcessor(new ShellProcessor("rm -f /var/spool/cron/crontabs/" + uid));
            proc.appendProcessor(new ShellProcessor("rm -f /var/mail/" + uid));
            return proc;
        }
        return null;
    }
    private void appendSetQuotaProcessor(CompoundProcessor aCP, UnixUser user) {