2023-10-12 15:45:04 -07:00
|
|
|
|
using Content.Shared.Administration;
|
2020-10-30 16:06:48 +01:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Client.Administration.Managers
|
2020-10-30 16:06:48 +01:00
|
|
|
|
{
|
2020-11-10 21:30:20 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Manages server admin permissions for the local player.
|
|
|
|
|
|
/// </summary>
|
2020-10-30 16:06:48 +01:00
|
|
|
|
public interface IClientAdminManager
|
|
|
|
|
|
{
|
2020-11-10 21:30:20 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Fired when the admin status of the local player changes, such as losing admin privileges.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
event Action AdminStatusUpdated;
|
2020-11-01 23:55:55 +01:00
|
|
|
|
|
2023-10-12 15:45:04 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets the admin data for the client, if they are an admin.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="includeDeAdmin">
|
|
|
|
|
|
/// Whether to return admin data for admins that are current de-adminned.
|
|
|
|
|
|
/// </param>
|
|
|
|
|
|
/// <returns><see langword="null" /> if the player is not an admin.</returns>
|
|
|
|
|
|
AdminData? GetAdminData(bool includeDeAdmin = false);
|
|
|
|
|
|
|
2021-02-16 20:14:32 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Checks whether the local player is an admin.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>true if the local player is an admin, false otherwise even if they are deadminned.</returns>
|
|
|
|
|
|
bool IsActive();
|
|
|
|
|
|
|
2020-11-10 21:30:20 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Checks whether the local player has an admin flag.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="flag">The flags to check. Multiple flags can be specified, they must all be held.</param>
|
|
|
|
|
|
/// <returns>False if the local player is not an admin, inactive, or does not have all the flags specified.</returns>
|
2020-10-30 16:06:48 +01:00
|
|
|
|
bool HasFlag(AdminFlags flag);
|
|
|
|
|
|
|
2020-11-10 21:30:20 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Check if a player can execute a specified console command.
|
|
|
|
|
|
/// </summary>
|
2020-10-30 16:06:48 +01:00
|
|
|
|
bool CanCommand(string cmdName);
|
2020-11-10 21:30:20 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Check if the local player can open the VV menu.
|
|
|
|
|
|
/// </summary>
|
2020-10-30 16:06:48 +01:00
|
|
|
|
bool CanViewVar();
|
2020-11-10 21:30:20 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Check if the local player can spawn stuff in with the entity/tile spawn panel.
|
|
|
|
|
|
/// </summary>
|
2020-10-30 16:06:48 +01:00
|
|
|
|
bool CanAdminPlace();
|
2020-11-10 21:30:20 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Check if the local player can execute server-side C# scripts.
|
|
|
|
|
|
/// </summary>
|
2020-10-30 16:06:48 +01:00
|
|
|
|
bool CanScript();
|
2020-11-10 21:30:20 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Check if the local player can open the admin menu.
|
|
|
|
|
|
/// </summary>
|
2020-10-30 16:06:48 +01:00
|
|
|
|
bool CanAdminMenu();
|
|
|
|
|
|
|
|
|
|
|
|
void Initialize();
|
2023-10-12 15:45:04 -07:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Checks if the client is an admin.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="includeDeAdmin">
|
|
|
|
|
|
/// Whether to return admin data for admins that are current de-adminned.
|
|
|
|
|
|
/// </param>
|
|
|
|
|
|
/// <returns>true if the player is an admin, false otherwise.</returns>
|
|
|
|
|
|
bool IsAdmin(bool includeDeAdmin = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
return GetAdminData(includeDeAdmin) != null;
|
|
|
|
|
|
}
|
2020-10-30 16:06:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|