Update to UserPerms
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2023-08-30 00:56:27 +02:00
Ursprung 661b75db00
Commit 66fc131803
Signiert von: Chaoscaot
GPG-Schlüssel-ID: BDF8FADD7D5EDB7A

Datei anzeigen

@ -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 {