validate pac names
This commit is contained in:
parent
551bb74712
commit
8e3050aade
@ -94,7 +94,11 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
||||
pac.setPacComponents(pacComponents);
|
||||
AbstractEntity newPacEntity = null;
|
||||
String pacType = pac.getBasepac().getName();
|
||||
String pacName = pac.getName();
|
||||
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>();
|
||||
pac.setUnixUser(users);
|
||||
UnixUser admin = new UnixUser();
|
||||
@ -115,6 +119,9 @@ public class PacModuleImpl extends AbstractModuleImpl {
|
||||
users.add(admin);
|
||||
newPacEntity = super.add(newEntity);
|
||||
} 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);
|
||||
}
|
||||
return newPacEntity;
|
||||
|
Loading…
Reference in New Issue
Block a user