Retrofit on "mentors" (admins with no perm except +ADMINHELP) (#5626)
Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
This commit is contained in:
@@ -1,15 +1,9 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -32,8 +26,8 @@ namespace Content.Server.Administration
|
||||
// TODO: Sanitize text?
|
||||
// Confirm that this person is actually allowed to send a message here.
|
||||
var senderPersonalChannel = senderSession.UserId == message.ChannelId;
|
||||
var senderAdmin = _adminManager.GetAdminData(senderSession) != null;
|
||||
var authorized = senderPersonalChannel || senderAdmin;
|
||||
var senderAdmin = _adminManager.GetAdminData(senderSession);
|
||||
var authorized = senderPersonalChannel || senderAdmin != null;
|
||||
if (!authorized)
|
||||
{
|
||||
// Unauthorized bwoink (log?)
|
||||
@@ -42,9 +36,16 @@ namespace Content.Server.Administration
|
||||
|
||||
var escapedText = Basic.EscapeText(message.Text);
|
||||
|
||||
var bwoinkText = senderAdmin
|
||||
? $"[color=red]{senderSession.Name}[/color]: {escapedText}"
|
||||
: $"{senderSession.Name}: {escapedText}";
|
||||
|
||||
var bwoinkText = senderAdmin switch
|
||||
{
|
||||
var x when x is not null && x.Flags == AdminFlags.Adminhelp =>
|
||||
$"[color=purple]{senderSession.Name}[/color]: {escapedText}",
|
||||
var x when x is not null && x.HasFlag(AdminFlags.Adminhelp) =>
|
||||
$"[color=red]{senderSession.Name}[/color]: {escapedText}",
|
||||
_ => $"{senderSession.Name}: {escapedText}",
|
||||
};
|
||||
|
||||
var msg = new BwoinkTextMessage(message.ChannelId, senderSession.UserId, bwoinkText);
|
||||
|
||||
LogBwoink(msg);
|
||||
|
||||
@@ -75,6 +75,11 @@ namespace Content.Shared.Administration
|
||||
/// </summary>
|
||||
Query = 1 << 11,
|
||||
|
||||
/// <summary>
|
||||
/// Lets you use the admin help system.
|
||||
/// </summary>
|
||||
Adminhelp = 1 << 12,
|
||||
|
||||
/// <summary>
|
||||
/// Dangerous host permissions like scsi.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user