delete pac databases
This commit is contained in:
parent
f8de19dd0d
commit
87f15fdba6
@ -126,15 +126,25 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
||||
}
|
||||
GenericModuleImpl helperModule = new GenericModuleImpl(getTransaction());
|
||||
|
||||
Query qDoms = em.createQuery("SELECT dom FROM Domains dom WHERE dom.user.pac.name = :pac");
|
||||
qDoms.setParameter("pac", pacName);
|
||||
List<?> domsList = qDoms.getResultList();
|
||||
for (Object o : domsList) {
|
||||
if (o instanceof Domain) {
|
||||
helperModule.delete((AbstractEntity) o);
|
||||
String[] dependQueries = new String[] {
|
||||
"SELECT dom FROM Domains dom WHERE dom.user.pac.name = :pac",
|
||||
"SELECT db FROM MySqlDatabases db WHERE db.pac.name = :pac",
|
||||
"SELECT db FROM PgSqlDatabases db WHERE db.pac.name = :pac",
|
||||
"SELECT dbusr FROM MySqlUsers dbusr WHERE dbusr.pac.name = :pac",
|
||||
"SELECT dbusr FROM PgSqlUsers dbusr WHERE dbusr.pac.name = :pac",
|
||||
};
|
||||
|
||||
for (String queryString : dependQueries) {
|
||||
Query qDoms = em.createQuery(queryString);
|
||||
qDoms.setParameter("pac", pacName);
|
||||
List<?> domsList = qDoms.getResultList();
|
||||
for (Object o : domsList) {
|
||||
if (o instanceof AbstractEntity) {
|
||||
helperModule.delete((AbstractEntity) o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (UnixUser user : pac.getUnixUser()) {
|
||||
if (!pacName.equals(user.getName())) {
|
||||
helperModule.delete(user);
|
||||
|
Loading…
Reference in New Issue
Block a user