Skip to content

Commit

Permalink
Hide uid data in moderation reports
Browse files Browse the repository at this point in the history
fixes #207
  • Loading branch information
Brutus5000 committed Nov 10, 2024
1 parent e4e2403 commit 99b8ba9
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 94 deletions.
182 changes: 92 additions & 90 deletions src/main/java/com/faforever/moderatorclient/ui/ViewHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public static void loadForceRenameDialog(UiService uiService, PlayerFX playerFX)
* @param onAddBan if not null shows a ban button which triggers this consumer
* @param communicationService
*/
public static void buildUserTableView(PlatformService platformService, TableView<PlayerFX> tableView, ObservableList<PlayerFX> data, Consumer<PlayerFX> onAddBan, Consumer<PlayerFX> onForceRename, FafApiCommunicationService communicationService) {
public static void buildUserTableView(PlatformService platformService, TableView<PlayerFX> tableView, ObservableList<PlayerFX> data, Consumer<PlayerFX> onAddBan, Consumer<PlayerFX> onForceRename, boolean showUidData, FafApiCommunicationService communicationService) {
tableView.setItems(data);
HashMap<TableColumn<PlayerFX, ?>, Function<PlayerFX, ?>> extractors = new HashMap<>();

Expand Down Expand Up @@ -626,95 +626,97 @@ protected void updateItem(PlayerFX item, boolean empty) {
tableView.getColumns().add(banOptionColumn);
}

TableColumn<PlayerFX, String> hashColumn = new TableColumn<>("Hash");
hashColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getHash)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
hashColumn.setMinWidth(200);
tableView.getColumns().add(hashColumn);
extractors.put(hashColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getHash).collect(Collectors.toList()));

TableColumn<PlayerFX, String> uuidColumn = new TableColumn<>("UUID");
uuidColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getUuid)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
uuidColumn.setMinWidth(200);
tableView.getColumns().add(uuidColumn);
extractors.put(uuidColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getUuid).collect(Collectors.toList()));

TableColumn<PlayerFX, String> memorySerialColumn = new TableColumn<>("Memory S/N");
memorySerialColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getMemorySerialNumber)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
memorySerialColumn.setMinWidth(200);
tableView.getColumns().add(memorySerialColumn);
extractors.put(memorySerialColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getMemorySerialNumber).collect(Collectors.toList()));

TableColumn<PlayerFX, String> deviceIdColumn = new TableColumn<>("Device ID");
deviceIdColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getDeviceId)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
deviceIdColumn.setMinWidth(200);
tableView.getColumns().add(deviceIdColumn);
extractors.put(deviceIdColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getDeviceId).collect(Collectors.toList()));

TableColumn<PlayerFX, String> manufacturerColumn = new TableColumn<>("Manufacturer");
manufacturerColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getManufacturer)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
manufacturerColumn.setMinWidth(200);
tableView.getColumns().add(manufacturerColumn);
extractors.put(manufacturerColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getManufacturer).collect(Collectors.toList()));

TableColumn<PlayerFX, String> cpuNameColumn = new TableColumn<>("Cpu Name");
cpuNameColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getName)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
cpuNameColumn.setMinWidth(200);
tableView.getColumns().add(cpuNameColumn);
extractors.put(cpuNameColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getName).collect(Collectors.toList()));

TableColumn<PlayerFX, String> processorIdColumn = new TableColumn<>("Processor Id");
processorIdColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getProcessorId)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
processorIdColumn.setMinWidth(200);
tableView.getColumns().add(processorIdColumn);
extractors.put(processorIdColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getProcessorId).collect(Collectors.toList()));

TableColumn<PlayerFX, String> biosVersionColumn = new TableColumn<>("BIOS Version");
biosVersionColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getSMBIOSBIOSVersion)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
biosVersionColumn.setMinWidth(200);
tableView.getColumns().add(biosVersionColumn);
extractors.put(biosVersionColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getSMBIOSBIOSVersion).collect(Collectors.toList()));

TableColumn<PlayerFX, String> serialColumn = new TableColumn<>("S/N");
serialColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getSerialNumber)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
serialColumn.setMinWidth(200);
tableView.getColumns().add(serialColumn);
extractors.put(serialColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getSerialNumber).collect(Collectors.toList()));

TableColumn<PlayerFX, String> volumeSerialNumber = new TableColumn<>("Volume S/N");
volumeSerialNumber.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getVolumeSerialNumber)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
volumeSerialNumber.setMinWidth(200);
tableView.getColumns().add(volumeSerialNumber);
extractors.put(volumeSerialNumber, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getVolumeSerialNumber).collect(Collectors.toList()));
if(showUidData) {
TableColumn<PlayerFX, String> hashColumn = new TableColumn<>("Hash");
hashColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getHash)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
hashColumn.setMinWidth(200);
tableView.getColumns().add(hashColumn);
extractors.put(hashColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getHash).collect(Collectors.toList()));

TableColumn<PlayerFX, String> uuidColumn = new TableColumn<>("UUID");
uuidColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getUuid)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
uuidColumn.setMinWidth(200);
tableView.getColumns().add(uuidColumn);
extractors.put(uuidColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getUuid).collect(Collectors.toList()));

TableColumn<PlayerFX, String> memorySerialColumn = new TableColumn<>("Memory S/N");
memorySerialColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getMemorySerialNumber)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
memorySerialColumn.setMinWidth(200);
tableView.getColumns().add(memorySerialColumn);
extractors.put(memorySerialColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getMemorySerialNumber).collect(Collectors.toList()));

TableColumn<PlayerFX, String> deviceIdColumn = new TableColumn<>("Device ID");
deviceIdColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getDeviceId)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
deviceIdColumn.setMinWidth(200);
tableView.getColumns().add(deviceIdColumn);
extractors.put(deviceIdColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getDeviceId).collect(Collectors.toList()));

TableColumn<PlayerFX, String> manufacturerColumn = new TableColumn<>("Manufacturer");
manufacturerColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getManufacturer)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
manufacturerColumn.setMinWidth(200);
tableView.getColumns().add(manufacturerColumn);
extractors.put(manufacturerColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getManufacturer).collect(Collectors.toList()));

TableColumn<PlayerFX, String> cpuNameColumn = new TableColumn<>("Cpu Name");
cpuNameColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getName)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
cpuNameColumn.setMinWidth(200);
tableView.getColumns().add(cpuNameColumn);
extractors.put(cpuNameColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getName).collect(Collectors.toList()));

TableColumn<PlayerFX, String> processorIdColumn = new TableColumn<>("Processor Id");
processorIdColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getProcessorId)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
processorIdColumn.setMinWidth(200);
tableView.getColumns().add(processorIdColumn);
extractors.put(processorIdColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getProcessorId).collect(Collectors.toList()));

TableColumn<PlayerFX, String> biosVersionColumn = new TableColumn<>("BIOS Version");
biosVersionColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getSMBIOSBIOSVersion)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
biosVersionColumn.setMinWidth(200);
tableView.getColumns().add(biosVersionColumn);
extractors.put(biosVersionColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getSMBIOSBIOSVersion).collect(Collectors.toList()));

TableColumn<PlayerFX, String> serialColumn = new TableColumn<>("S/N");
serialColumn.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getSerialNumber)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
serialColumn.setMinWidth(200);
tableView.getColumns().add(serialColumn);
extractors.put(serialColumn, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getSerialNumber).collect(Collectors.toList()));

TableColumn<PlayerFX, String> volumeSerialNumber = new TableColumn<>("Volume S/N");
volumeSerialNumber.setCellValueFactory(o -> Bindings.createStringBinding(() ->
o.getValue().getUniqueIds().stream().map(UniqueIdFx::getVolumeSerialNumber)
.collect(Collectors.joining("\n")),
o.getValue().getUniqueIds()));
volumeSerialNumber.setMinWidth(200);
tableView.getColumns().add(volumeSerialNumber);
extractors.put(volumeSerialNumber, playerFX -> playerFX.getUniqueIds().stream().map(UniqueIdFx::getVolumeSerialNumber).collect(Collectors.toList()));
}

ContextMenu contextMenu = applyCopyContextMenus(tableView, extractors);
MenuItem steamLookupMenuItem = new MenuItem("Lookup SteamID");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private boolean checkPermissionForTitledPane(String permissionTechnicalName, Tit
public void initialize() {
if (checkPermissionForTitledPane(GroupPermission.ROLE_READ_ACCOUNT_PRIVATE_DETAILS, userRegistrationFeedPane)) {
ViewHelper.buildUserTableView(platformService, userRegistrationFeedTableView, users, this::addBan,
playerFX -> ViewHelper.loadForceRenameDialog(uiService, playerFX), communicationService);
playerFX -> ViewHelper.loadForceRenameDialog(uiService, playerFX), true, communicationService);
}

if (checkPermissionForTitledPane(GroupPermission.ROLE_READ_TEAMKILL_REPORT, teamkillFeedPane)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void initialize() {
disableTabOnMissingPermission(userGroupsTab, GroupPermission.ROLE_READ_USER_GROUP);

ViewHelper.buildUserTableView(platformService, userSearchTableView, users, null,
playerFX -> ViewHelper.loadForceRenameDialog(uiService, playerFX), communicationService);
playerFX -> ViewHelper.loadForceRenameDialog(uiService, playerFX), true, communicationService);
ViewHelper.buildNotesTableView(userNoteTableView, userNotes, false);
ViewHelper.buildNameHistoryTableView(userNameHistoryTableView, nameRecords);
ViewHelper.buildBanTableView(userBansTableView, bans, false);
Expand Down Expand Up @@ -253,7 +253,7 @@ private void onSelectedUser(ObservableValue<? extends PlayerFX> observable, Play
if (!userGroupsTab.isDisable()) {
permissionService.getPlayersUserGroups(newValue).thenAccept(playerGroups -> {
userGroups.addAll(playerGroups);
groupPermissions.addAll(playerGroups.stream().flatMap(userGroupFX -> userGroupFX.getPermissions().stream()).distinct().collect(Collectors.toList()));
groupPermissions.addAll(playerGroups.stream().flatMap(userGroupFX -> userGroupFX.getPermissions().stream()).distinct().toList());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void initialize() {
chatLogTextArea.setText("select a report first");

ViewHelper.buildUserTableView(platformService, reportedPlayerView, reportedPlayersOfCurrentlySelectedReport, this::addBan,
playerFX -> ViewHelper.loadForceRenameDialog(uiService, playerFX), communicationService);
playerFX -> ViewHelper.loadForceRenameDialog(uiService, playerFX), false, communicationService);
}

private void addBan(PlayerFX accountFX) {
Expand Down

0 comments on commit 99b8ba9

Please sign in to comment.