extend validation of user and database names
This commit is contained in:
parent
ab81cb8835
commit
3a704c322a
@ -48,7 +48,7 @@ public abstract class Database extends AbstractEntity implements Serializable {
|
||||
@Column(name = "engine", columnDefinition = "character varying(12)", updatable=false)
|
||||
private String instance;
|
||||
|
||||
@AnnFieldIO(validation="[a-z0-9\\_]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-z0-9]{5}_[a-z0-9_]{1,}", rw=ReadWriteAccess.WRITEONCE)
|
||||
@Column(name = "name", columnDefinition = "character varying(24)", updatable=false)
|
||||
private String name;
|
||||
|
||||
|
@ -43,11 +43,11 @@ 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\\_]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-z0-9]{5}_[a-z0-9_]{1,}", rw=ReadWriteAccess.WRITEONCE)
|
||||
@Column(name = "name", columnDefinition = "character varying(24)", updatable=false)
|
||||
private String name;
|
||||
|
||||
@AnnFieldIO(validation="[^']*", rw=ReadWriteAccess.WRITEONLY)
|
||||
@AnnFieldIO(validation="[^']{6,}", rw=ReadWriteAccess.WRITEONLY)
|
||||
@Transient
|
||||
private String password;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class EMailAlias extends AbstractEntity implements Serializable {
|
||||
@AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
|
||||
private Pac pac;
|
||||
|
||||
@AnnFieldIO(validation="[a-z0-9\\_\\-\\.\\+]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-z0-9]{5}-[a-z0-9\\.\\_\\+]{1,}", rw=ReadWriteAccess.WRITEONCE)
|
||||
@Column(updatable=false)
|
||||
private String name;
|
||||
|
||||
|
@ -40,11 +40,11 @@ public class UnixUser extends AbstractEntity implements Serializable {
|
||||
@Column(name="userid", columnDefinition="integer", nullable=false, updatable=false)
|
||||
private long userId;
|
||||
|
||||
@AnnFieldIO(validation="[a-z0-9\\_\\-\\.]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-z0-9]{5}-[a-z0-9\\.\\_]{1,}", rw=ReadWriteAccess.WRITEONCE)
|
||||
@Column(name="name", columnDefinition = "character varying(24)", unique=true, updatable=false)
|
||||
private String name;
|
||||
|
||||
@AnnFieldIO(validation="[^:]*", rw=ReadWriteAccess.WRITEONLY)
|
||||
@AnnFieldIO(validation="[^:]{6,}", rw=ReadWriteAccess.WRITEONLY)
|
||||
@Transient
|
||||
private String password;
|
||||
|
||||
|
20
hsarback/test/de/hsadmin/validate/PacName.java
Normal file
20
hsarback/test/de/hsadmin/validate/PacName.java
Normal file
@ -0,0 +1,20 @@
|
||||
package de.hsadmin.validate;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
public class PacName {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Pattern pattern = Pattern.compile("[a-z0-9]{5}-[a-z0-9\\.\\_]{1,}");
|
||||
System.out.println("xyz00-a.b " + pattern.matcher("xyz00-a.b").matches());
|
||||
System.out.println("xyz00-a-b " + pattern.matcher("xyz00-a-b").matches());
|
||||
System.out.println("xyz00-a.B " + pattern.matcher("xyz00-a.B").matches());
|
||||
System.out.println("xyz00- " + pattern.matcher("xyz00-").matches());
|
||||
System.out.println("xyz00 " + pattern.matcher("xyz00").matches());
|
||||
System.out.println("xyz0 " + pattern.matcher("xyz0").matches());
|
||||
System.out.println("xyz00_a " + pattern.matcher("xyz00_a").matches());
|
||||
System.out.println("xyz00-a.b:c " + pattern.matcher("xyz00-a.b:c").matches());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user