Fix client-only command permissions. (#5899)
This commit is contained in:
committed by
GitHub
parent
1e42bafea4
commit
666be08d86
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Linq;
|
||||
using Content.Client.Resources;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.ResourceManagement;
|
||||
@@ -198,7 +199,7 @@ namespace Content.Client.Changelog
|
||||
}
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
[UsedImplicitly, AnyCommand]
|
||||
public sealed class ChangelogCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "changelog";
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using Content.Client.Credits;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.Administration;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[UsedImplicitly, AnyCommand]
|
||||
public sealed class CreditsCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "credits";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Content.Shared;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
@@ -6,6 +6,7 @@ using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Client.Commands
|
||||
{
|
||||
[AnyCommand]
|
||||
public class ToggleOutlineCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "toggleoutline";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Voting;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.AutoGenerated;
|
||||
@@ -150,7 +151,7 @@ namespace Content.Client.Voting.UI
|
||||
}
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
[UsedImplicitly, AnyCommand]
|
||||
public sealed class VoteMenuCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "votemenu";
|
||||
|
||||
@@ -193,7 +193,19 @@ namespace Content.Server.Administration.Managers
|
||||
}
|
||||
|
||||
// Load flags for engine commands, since those don't have the attributes.
|
||||
if (_res.TryContentFileRead(new ResourcePath("/engineCommandPerms.yml"), out var fs))
|
||||
if (_res.TryContentFileRead(new ResourcePath("/engineCommandPerms.yml"), out var efs))
|
||||
{
|
||||
LoadPermissionsFromStream(efs);
|
||||
}
|
||||
|
||||
// Load flags for client-only commands, those don't have the flag attributes, only "AnyCommand".
|
||||
if (_res.TryContentFileRead(new ResourcePath("/clientCommandPerms.yml"), out var cfs))
|
||||
{
|
||||
LoadPermissionsFromStream(cfs);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadPermissionsFromStream(Stream fs)
|
||||
{
|
||||
using var reader = new StreamReader(fs, EncodingHelpers.UTF8);
|
||||
var yStream = new YamlStream();
|
||||
@@ -228,7 +240,7 @@ namespace Content.Server.Administration.Managers
|
||||
_anyCommands.UnionWith(commands);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void PromoteHost(IPlayerSession player)
|
||||
|
||||
30
Resources/clientCommandPerms.yml
Normal file
30
Resources/clientCommandPerms.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
- Flags: DEBUG
|
||||
Commands:
|
||||
- atvrange
|
||||
- atvmode
|
||||
- atvcbm
|
||||
- debugai
|
||||
- notify
|
||||
- pathfinder
|
||||
- entitymenug
|
||||
- hidemechanisms
|
||||
- showmechanisms
|
||||
- menuvis
|
||||
- togglehealthoverlay
|
||||
- toggledecals
|
||||
- nodevis
|
||||
- nodevisfilter
|
||||
|
||||
- Flags: MAPPING
|
||||
Commands:
|
||||
- showmarkers
|
||||
- showsubfloor
|
||||
- showsubfloorforever
|
||||
- mapping
|
||||
- toggledecals
|
||||
- nodevis
|
||||
- nodevisfilter
|
||||
|
||||
- Flags: ADMIN
|
||||
Commands:
|
||||
- togglehealthoverlay
|
||||
@@ -38,7 +38,9 @@ SHARED_IGNORED_RESOURCES = {
|
||||
CLIENT_IGNORED_RESOURCES = {
|
||||
"Maps",
|
||||
"emotes.xml",
|
||||
"Groups"
|
||||
"Groups",
|
||||
"engineCommandPerms.yml",
|
||||
"clientCommandPerms.yml"
|
||||
}
|
||||
|
||||
CLIENT_CONTENT_ASSEMBLIES = [
|
||||
|
||||
Reference in New Issue
Block a user