namespace Content.Shared.Administration
{
///
/// Represents data for a single server admin.
///
public sealed class AdminData
{
// Can be false if they're de-adminned with the ability to re-admin.
///
/// Whether the admin is currently active. This can be false if they have de-adminned mid-round.
///
public bool Active;
///
/// Whether the admin is in stealth mode and won't appear in adminwho to admins without the Stealth flag.
///
public bool Stealth;
///
/// The admin's title.
///
public string? Title;
///
/// The admin's permission flags.
///
public AdminFlags Flags;
///
/// Checks whether this admin has an admin flag.
///
/// The flags to check. Multiple flags can be specified, they must all be held.
/// If true then also count flags even if the admin has de-adminned.
/// False if this admin is not or does not have all the flags specified.
public bool HasFlag(AdminFlags flag, bool includeDeAdmin = false)
{
return (includeDeAdmin || Active) && (Flags & flag) == flag;
}
///
/// Check if this admin can spawn stuff in with the entity/tile spawn panel.
///
public bool CanAdminPlace()
{
return HasFlag(AdminFlags.Spawn);
}
///
/// Check if this admin can execute server-side C# scripts.
///
public bool CanScript()
{
return HasFlag(AdminFlags.Host);
}
///
/// Check if this admin can open the admin menu.
///
public bool CanAdminMenu()
{
return HasFlag(AdminFlags.Admin);
}
///
/// Check if this admin can be hidden and see other hidden admins.
///
public bool CanStealth()
{
return HasFlag(AdminFlags.Stealth);
}
public bool CanAdminReloadPrototypes()
{
return HasFlag(AdminFlags.Host);
}
}
}