Add context menu to AdminMenu PlayerTab entries (#5904)

* XAML PlayerTab entries

* Move command execution to PlayerTab

* Move command logic to the AdminSystem

* Clean up

* Add examine and context menu keybind handling to PlayerTab

* Fix remote admin verbs

* Remove examine for now

* Add server verbs

* Fix requests of verb by non-admins

* Clean up AdminSystem.Menu
This commit is contained in:
ShadowCommander
2021-12-30 14:11:30 -08:00
committed by GitHub
parent a28dba915f
commit dc1ca30f7c
8 changed files with 38 additions and 11 deletions

View File

@@ -1,4 +1,6 @@
using Content.Server.Administration.Managers;
using Content.Server.Popups;
using Content.Shared.Administration;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Hands.Components;
@@ -15,6 +17,7 @@ namespace Content.Server.Verbs
{
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IAdminManager _adminMgr = default!;
public override void Initialize()
{
@@ -43,7 +46,11 @@ namespace Content.Server.Verbs
// this, and some verbs (e.g. view variables) won't even care about whether an entity is accessible through
// the entity menu or not.
var response = new VerbsResponseEvent(args.EntityUid, GetLocalVerbs(args.EntityUid, attached, args.Type));
var force = args.AdminRequest && eventArgs.SenderSession is IPlayerSession playerSession &&
_adminMgr.HasAdminFlag(playerSession, AdminFlags.Admin);
var response =
new VerbsResponseEvent(args.EntityUid, GetLocalVerbs(args.EntityUid, attached, args.Type, force));
RaiseNetworkEvent(response, player.ConnectedClient);
}