parent
3c1480dfaf
commit
696fd165fe
@ -35,7 +35,7 @@ import de.hsadmin.core.model.onetier.TicketValidator;
|
|||||||
public class CLIClientConnectorServlet extends HttpServlet {
|
public class CLIClientConnectorServlet extends HttpServlet {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7150004719303750077L;
|
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, Class<?>> componentmap;
|
||||||
private Map<String, String> componentDescriptions;
|
private Map<String, String> componentDescriptions;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package de.hsadmin.mods.user;
|
package de.hsadmin.mods.user;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
|
||||||
import de.hsadmin.core.model.AbstractEntity;
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
@ -55,18 +52,22 @@ public class UnixUserProcessorFactory implements EntityProcessorFactory {
|
|||||||
/**
|
/**
|
||||||
* @return a Processor which deletes an existing UNIX user account
|
* @return a Processor which deletes an existing UNIX user account
|
||||||
*/
|
*/
|
||||||
public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em,
|
public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) {
|
||||||
T entity) {
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyMMdd-HHmm-");
|
|
||||||
String trashPrefix = "/home/trash/" + sdf.format(new Date());
|
|
||||||
|
|
||||||
UnixUser user = (UnixUser) entity;
|
UnixUser user = (UnixUser) entity;
|
||||||
CompoundProcessor aCP = new CompoundProcessor();
|
String uid = user.getName();
|
||||||
if (user.isDefaultHomedir())
|
if (uid != null && uid.length() > 4) {
|
||||||
aCP.appendProcessor(new ShellProcessor("mv '" + user.getHomedir()
|
Processor userdelProc = null;
|
||||||
+ "' '" + trashPrefix + user.getName() + "'"));
|
if (user.isDefaultHomedir()) {
|
||||||
aCP.appendProcessor(new ShellProcessor("userdel " + user.getName()));
|
userdelProc = new ShellProcessor("userdel " + uid + " && rm -rf '" + user.getHomedir() + "'");
|
||||||
return aCP;
|
} 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) {
|
private void appendSetQuotaProcessor(CompoundProcessor aCP, UnixUser user) {
|
||||||
|
Loading…
Reference in New Issue
Block a user