Skip to content

Commit

Permalink
Adds a Pii Flag, Censors Hwid and Ip (#27776)
Browse files Browse the repository at this point in the history
* yes

* fixes
  • Loading branch information
Geekyhobo authored and Evgencheg committed Sep 22, 2024
1 parent f88a6e4 commit c8ced07
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
35 changes: 27 additions & 8 deletions Content.Server/Administration/BanList/BanListEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,23 @@ private async Task LoadBans(NetUserId userId)
unban = new SharedServerUnban(unbanningAdmin, ban.Unban.UnbanTime.UtcDateTime);
}

(string, int cidrMask)? ip = ("*Hidden*", 0);
var hwid = "*Hidden*";

if (_admins.HasAdminFlag(Player, AdminFlags.Pii))
{
ip = ban.Address is { } address
? (address.address.ToString(), address.cidrMask)
: null;

hwid = ban.HWId == null ? null : Convert.ToBase64String(ban.HWId.Value.AsSpan());
}

Bans.Add(new SharedServerBan(
ban.Id,
ban.UserId,
ban.Address is { } address
? (address.address.ToString(), address.cidrMask)
: null,
ban.HWId == null ? null : Convert.ToBase64String(ban.HWId.Value.AsSpan()),
ip,
hwid,
ban.BanTime.UtcDateTime,
ban.ExpirationTime?.UtcDateTime,
ban.Reason,
Expand All @@ -96,13 +106,22 @@ private async Task LoadRoleBans(NetUserId userId)
unban = new SharedServerUnban(unbanningAdmin, ban.Unban.UnbanTime.UtcDateTime);
}

(string, int cidrMask)? ip = ("*Hidden*", 0);
var hwid = "*Hidden*";

if (_admins.HasAdminFlag(Player, AdminFlags.Pii))
{
ip = ban.Address is { } address
? (address.address.ToString(), address.cidrMask)
: null;

hwid = ban.HWId == null ? null : Convert.ToBase64String(ban.HWId.Value.AsSpan());
}
RoleBans.Add(new SharedServerRoleBan(
ban.Id,
ban.UserId,
ban.Address is { } address
? (address.address.ToString(), address.cidrMask)
: null,
ban.HWId == null ? null : Convert.ToBase64String(ban.HWId.Value.AsSpan()),
ip,
hwid,
ban.BanTime.UtcDateTime,
ban.ExpirationTime?.UtcDateTime,
ban.Reason,
Expand Down
5 changes: 5 additions & 0 deletions Content.Shared/Administration/AdminFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ public enum AdminFlags : uint
///</summary>
Adminchat = 1 << 17,

///<summary>
/// Permits the visibility of Pii in game and on SS14 Admin
///</summary>
Pii = 1 << 18,

/// <summary>
/// DeltaV - The ability to whitelist people. Either this permission or +BAN is required for remove.
/// </summary>
Expand Down

0 comments on commit c8ced07

Please sign in to comment.