Dieser Commit ist enthalten in:
Ursprung
661b75db00
Commit
66fc131803
@ -19,10 +19,7 @@
|
||||
|
||||
package de.steamwar.sql;
|
||||
|
||||
import de.steamwar.sql.internal.Field;
|
||||
import de.steamwar.sql.internal.SelectStatement;
|
||||
import de.steamwar.sql.internal.SqlTypeMapper;
|
||||
import de.steamwar.sql.internal.Table;
|
||||
import de.steamwar.sql.internal.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@ -67,11 +64,21 @@ public enum UserPerm {
|
||||
|
||||
private static final Table<UserPermTable> table = new Table<>(UserPermTable.class, "UserPerm");
|
||||
private static final SelectStatement<UserPermTable> getPerms = table.selectFields("user");
|
||||
private static final Statement addPerm = table.insertFields("user", "perm");
|
||||
private static final Statement removePerm = table.delete(Table.PRIMARY);
|
||||
|
||||
public static Set<UserPerm> getPerms(int user) {
|
||||
return getPerms.listSelect(user).stream().map(up -> up.perm).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public static void addPerm(SteamwarUser user, UserPerm perm) {
|
||||
addPerm.update(user, perm);
|
||||
}
|
||||
|
||||
public static void removePerm(SteamwarUser user, UserPerm perm) {
|
||||
removePerm.update(user, perm);
|
||||
}
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public static class Prefix {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren