39 lines
794 B
Java
39 lines
794 B
Java
package eu.eudat.types;
|
|
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Created by ikalyvas on 1/30/2018.
|
|
*/
|
|
public enum Authorities {
|
|
USER(0), MANAGER(1), ADMIN(2);
|
|
|
|
private Integer value;
|
|
|
|
private Authorities(Integer value) {
|
|
this.value = value;
|
|
}
|
|
|
|
public Integer getValue() {
|
|
return value;
|
|
}
|
|
|
|
public static Authorities fromInteger(Integer value) {
|
|
switch (value) {
|
|
case 0:
|
|
return USER;
|
|
case 1:
|
|
return MANAGER;
|
|
case 2:
|
|
return ADMIN;
|
|
default:
|
|
throw new RuntimeException("Unsupported Authority Type");
|
|
}
|
|
}
|
|
|
|
public static List<Authorities> all(){
|
|
return Arrays.asList(USER,ADMIN,MANAGER);
|
|
}
|
|
}
|