AdminManager can now load permissions for registered callback commands. (#6025)
This commit is contained in:
committed by
GitHub
parent
414225f463
commit
c4bf0a9479
@@ -12,7 +12,7 @@ namespace Content.Server.Administration
|
||||
/// If this attribute is used multiple times, either attribute's flag sets can be used to get access.
|
||||
/// </remarks>
|
||||
/// <seealso cref="AnyCommandAttribute"/>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
|
||||
[BaseTypeRequired(typeof(IConsoleCommand))]
|
||||
[MeansImplicitUse]
|
||||
public sealed class AdminCommandAttribute : Attribute
|
||||
|
||||
@@ -436,7 +436,13 @@ namespace Content.Server.Administration.Managers
|
||||
|
||||
private static (bool isAvail, AdminFlags[] flagsReq) GetRequiredFlag(IConsoleCommand cmd)
|
||||
{
|
||||
var type = cmd.GetType();
|
||||
MemberInfo type = cmd.GetType();
|
||||
|
||||
if (cmd is ConsoleHost.RegisteredCommand registered)
|
||||
{
|
||||
type = registered.Callback.Method;
|
||||
}
|
||||
|
||||
if (Attribute.IsDefined(type, typeof(AnyCommandAttribute)))
|
||||
{
|
||||
// Available to everybody.
|
||||
|
||||
Reference in New Issue
Block a user