Add admin boolean for users.
This commit is contained in:
6
src/main/java/org/cerberus/constant/Role.java
Normal file
6
src/main/java/org/cerberus/constant/Role.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package org.cerberus.constant;
|
||||||
|
|
||||||
|
public enum Role {
|
||||||
|
VIEWER,
|
||||||
|
MAINTAINER;
|
||||||
|
}
|
||||||
7
src/main/java/org/cerberus/constant/RoleSecurity.java
Normal file
7
src/main/java/org/cerberus/constant/RoleSecurity.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package org.cerberus.constant;
|
||||||
|
|
||||||
|
public class RoleSecurity {
|
||||||
|
public static final String VIEWER = Role.VIEWER.name();
|
||||||
|
public static final String MAINTAINER = Role.MAINTAINER.name();
|
||||||
|
public static final String ADMIN = "ADMIN";
|
||||||
|
}
|
||||||
@@ -25,6 +25,9 @@ public class User {
|
|||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Boolean isAdmin = false;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
@Generated(GenerationTime.ALWAYS)
|
@Generated(GenerationTime.ALWAYS)
|
||||||
private LocalDate inscriptionDate;
|
private LocalDate inscriptionDate;
|
||||||
@@ -64,6 +67,14 @@ public class User {
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getAdmin() {
|
||||||
|
return isAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdmin(Boolean admin) {
|
||||||
|
isAdmin = admin;
|
||||||
|
}
|
||||||
|
|
||||||
public LocalDate getInscriptionDate() {
|
public LocalDate getInscriptionDate() {
|
||||||
return inscriptionDate;
|
return inscriptionDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ CREATE TABLE "user" (
|
|||||||
email VARCHAR NOT NULL UNIQUE,
|
email VARCHAR NOT NULL UNIQUE,
|
||||||
password VARCHAR NOT NULL,
|
password VARCHAR NOT NULL,
|
||||||
inscription_date DATE DEFAULT current_date,
|
inscription_date DATE DEFAULT current_date,
|
||||||
|
is_admin BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
CONSTRAINT user_pk PRIMARY KEY (id)
|
CONSTRAINT user_pk PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user