2022-07-20 13:18:57 +02:00
|
|
|
package fr.pandacube.lib.permissions;
|
2021-03-21 20:17:31 +01:00
|
|
|
|
2022-07-20 13:18:57 +02:00
|
|
|
import fr.pandacube.lib.db.SQLElement;
|
|
|
|
import fr.pandacube.lib.db.SQLField;
|
2021-03-21 20:17:31 +01:00
|
|
|
|
|
|
|
public class SQLPermissions extends SQLElement<SQLPermissions> {
|
|
|
|
|
|
|
|
public SQLPermissions() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
public SQLPermissions(int id) {
|
|
|
|
super(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected String tableName() {
|
2021-03-21 22:40:05 +01:00
|
|
|
return "permissions";
|
2021-03-21 20:17:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public static final SQLField<SQLPermissions, String> name = field(VARCHAR(64), false);
|
|
|
|
public static final SQLField<SQLPermissions, Integer> type = field(TINYINT, false);
|
|
|
|
public static final SQLField<SQLPermissions, String> key = field(VARCHAR(256), false);
|
|
|
|
public static final SQLField<SQLPermissions, String> value = field(VARCHAR(256), false);
|
|
|
|
public static final SQLField<SQLPermissions, String> server = field(VARCHAR(64), true);
|
|
|
|
public static final SQLField<SQLPermissions, String> world = field(VARCHAR(64), true);
|
|
|
|
|
|
|
|
|
|
|
|
public enum EntityType {
|
|
|
|
User,
|
|
|
|
Group;
|
|
|
|
|
|
|
|
public int getCode() {
|
|
|
|
return ordinal();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static EntityType getByCode(int code) {
|
|
|
|
if (code >= 0 && code < values().length)
|
|
|
|
return values()[code];
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|