validate pac names
This commit is contained in:
parent
551bb74712
commit
8e3050aade
@ -94,7 +94,11 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
|||||||
pac.setPacComponents(pacComponents);
|
pac.setPacComponents(pacComponents);
|
||||||
AbstractEntity newPacEntity = null;
|
AbstractEntity newPacEntity = null;
|
||||||
String pacType = pac.getBasepac().getName();
|
String pacType = pac.getBasepac().getName();
|
||||||
|
String pacName = pac.getName();
|
||||||
if (pacType.equals(BasePacType.PAC_WEB)) {
|
if (pacType.equals(BasePacType.PAC_WEB)) {
|
||||||
|
if (pacName == null || pacName.length() != 5) {
|
||||||
|
throw new HSAdminException("webspace names require 5 characters");
|
||||||
|
}
|
||||||
Set<UnixUser> users = new HashSet<UnixUser>();
|
Set<UnixUser> users = new HashSet<UnixUser>();
|
||||||
pac.setUnixUser(users);
|
pac.setUnixUser(users);
|
||||||
UnixUser admin = new UnixUser();
|
UnixUser admin = new UnixUser();
|
||||||
@ -115,6 +119,9 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
|||||||
users.add(admin);
|
users.add(admin);
|
||||||
newPacEntity = super.add(newEntity);
|
newPacEntity = super.add(newEntity);
|
||||||
} else {
|
} else {
|
||||||
|
if (pacName == null || pacName.length() != 6 || !pacName.startsWith("vm")) {
|
||||||
|
throw new HSAdminException("vm names require 6 characters stating with 'vm'");
|
||||||
|
}
|
||||||
newPacEntity = super.add(newEntity);
|
newPacEntity = super.add(newEntity);
|
||||||
}
|
}
|
||||||
return newPacEntity;
|
return newPacEntity;
|
||||||
|
Loading…
Reference in New Issue
Block a user