using Robust.Shared.Players;
namespace Content.Shared.Administration.Managers;
///
/// Manages server administrators and their permission flags.
///
public interface ISharedAdminManager
{
///
/// Gets the admin data for a player, if they are an admin.
///
///
/// When used by the client, this only returns accurate results for the player's own entity.
///
///
/// Whether to return admin data for admins that are current de-adminned.
///
/// if the player is not an admin.
AdminData? GetAdminData(EntityUid uid, bool includeDeAdmin = false);
///
/// Gets the admin data for a player, if they are an admin.
///
///
/// When used by the client, this only returns accurate results for the player's own session.
///
///
/// Whether to return admin data for admins that are current de-adminned.
///
/// if the player is not an admin.
AdminData? GetAdminData(ICommonSession session, bool includeDeAdmin = false);
///
/// See if a player has an admin flag.
///
///
/// When used by the client, this only returns accurate results for the player's own entity.
///
/// True if the player is and admin and has the specified flags.
bool HasAdminFlag(EntityUid player, AdminFlags flag)
{
var data = GetAdminData(player);
return data != null && data.HasFlag(flag);
}
///
/// See if a player has an admin flag.
///
///
/// When used by the client, this only returns accurate results for the player's own session.
///
/// True if the player is and admin and has the specified flags.
bool HasAdminFlag(ICommonSession player, AdminFlags flag)
{
var data = GetAdminData(player);
return data != null && data.HasFlag(flag);
}
///
/// Checks if a player is an admin.
///
///
/// When used by the client, this only returns accurate results for the player's own entity.
///
///
/// Whether to return admin data for admins that are current de-adminned.
///
/// true if the player is an admin, false otherwise.
bool IsAdmin(EntityUid uid, bool includeDeAdmin = false)
{
return GetAdminData(uid, includeDeAdmin) != null;
}
///
/// Checks if a player is an admin.
///
///
/// When used by the client, this only returns accurate results for the player's own session.
///
///
/// Whether to return admin data for admins that are current de-adminned.
///
/// true if the player is an admin, false otherwise.
bool IsAdmin(ICommonSession session, bool includeDeAdmin = false)
{
return GetAdminData(session, includeDeAdmin) != null;
}
}