max username length is 32 everywhere

This commit is contained in:
Peter Hormanns 2020-04-28 18:01:21 +02:00
parent 69c0882228
commit 4671cbc996
3 changed files with 2 additions and 5 deletions

View File

@ -43,7 +43,7 @@ public abstract class DatabaseUser extends AbstractEntity implements Serializabl
@Column(name = "dbuser_id", columnDefinition = "integer", updatable=false, insertable=false)
private long id;
@AnnFieldIO(validation="[a-z0-9]{5}_[a-z0-9_]{1,}", rw=ReadWriteAccess.WRITEONCE)
@AnnFieldIO(validation="[a-z0-9]{5}_[a-z0-9_]{1,26}", rw=ReadWriteAccess.WRITEONCE)
@Column(name = "name", columnDefinition = "character varying(64)", updatable=false)
private String name;

View File

@ -26,9 +26,6 @@ public class MySqlUserModuleImpl extends AbstractModuleImpl {
if (name.length() < 7 || name.charAt(5) != '_') {
throw new AuthorisationException(loginUser, "add", newEntity);
}
if (name.length() > 16) {
throw new HSAdminException("mysql database name max. length is 16 characters");
}
EntityManager em = getTransaction().getEntityManager();
Query qPac = em.createQuery("SELECT obj FROM Pacs obj WHERE obj.name = :pacName");
qPac.setParameter("pacName", name.substring(0, 5));

View File

@ -40,7 +40,7 @@ public class UnixUser extends AbstractEntity implements Serializable {
@Column(name="userid", columnDefinition="integer", nullable=false, updatable=false)
private long userId;
@AnnFieldIO(validation="[a-z0-9]{5}(-[a-z0-9\\.\\_]{1,})?", rw=ReadWriteAccess.WRITEONCE)
@AnnFieldIO(validation="[a-z0-9]{5}(-[a-z0-9\\.\\_]{1,26})?", rw=ReadWriteAccess.WRITEONCE)
@Column(name="name", columnDefinition = "character varying(64)", unique=true, updatable=false)
private String name;