Paket und Admin-User in HSDB anlegen
This commit is contained in:
parent
39c0c3b8c2
commit
6bb368fb37
@ -11,7 +11,9 @@ import javax.persistence.Query;
|
|||||||
import de.hsadmin.core.model.AbstractEntity;
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
import de.hsadmin.core.model.AbstractModuleImpl;
|
import de.hsadmin.core.model.AbstractModuleImpl;
|
||||||
import de.hsadmin.core.model.HSAdminException;
|
import de.hsadmin.core.model.HSAdminException;
|
||||||
|
import de.hsadmin.mods.cust.Contact;
|
||||||
import de.hsadmin.mods.cust.Customer;
|
import de.hsadmin.mods.cust.Customer;
|
||||||
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
public class PacModuleImpl extends AbstractModuleImpl {
|
public class PacModuleImpl extends AbstractModuleImpl {
|
||||||
|
|
||||||
@ -77,6 +79,21 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
|||||||
pacComponents.add(pacComponent);
|
pacComponents.add(pacComponent);
|
||||||
}
|
}
|
||||||
pac.setPacComponents(pacComponents);
|
pac.setPacComponents(pacComponents);
|
||||||
|
Set<UnixUser> users = new HashSet<UnixUser>();
|
||||||
|
pac.setUnixUser(users);
|
||||||
|
UnixUser admin = new UnixUser();
|
||||||
|
Contact contact = customer.getContractualContact();
|
||||||
|
admin.setComment(contact.getFirstName() + " " + contact.getLastName());
|
||||||
|
admin.setHomedir("/home/pacs/" + pac.getName());
|
||||||
|
admin.setName(pac.getName());
|
||||||
|
admin.setShell("/bin/bash");
|
||||||
|
admin.setQuotaSoftlimit(0);
|
||||||
|
admin.setQuotaHardlimit(0);
|
||||||
|
admin.setPac(pac);
|
||||||
|
long nUID = 20000;
|
||||||
|
Long maxUid = (Long) em.createQuery("SELECT MAX(u.userId) FROM UnixUsers u").getSingleResult();
|
||||||
|
if (maxUid >= nUID) nUID = maxUid + 1;
|
||||||
|
admin.setUserId(nUID);
|
||||||
return super.add(newEntity);
|
return super.add(newEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,8 +156,10 @@ public class UnixUser extends de.hsadmin.core.model.AbstractEntity implements Se
|
|||||||
|
|
||||||
public void setPac(Pac pac) {
|
public void setPac(Pac pac) {
|
||||||
this.pac = pac;
|
this.pac = pac;
|
||||||
|
if (pac.getUnixUser() != null) {
|
||||||
pac.getUnixUser().add(this);
|
pac.getUnixUser().add(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getComment() {
|
public String getComment() {
|
||||||
return comment;
|
return comment;
|
||||||
|
@ -75,10 +75,9 @@ public class PacTest {
|
|||||||
assertNotNull(execute);
|
assertNotNull(execute);
|
||||||
fail("exception expected");
|
fail("exception expected");
|
||||||
} catch (XmlRpcException e) {
|
} catch (XmlRpcException e) {
|
||||||
// System.out.println(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreate() {
|
public void testCreate() {
|
||||||
|
Loading…
Reference in New Issue
Block a user