using Robust.Shared.Player; 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. /// /// /// Whether to check flags even for admins that are current de-adminned. /// /// True if the player is and admin and has the specified flags. bool HasAdminFlag(EntityUid player, AdminFlags flag, bool includeDeAdmin = false) { var data = GetAdminData(player, includeDeAdmin); return data != null && data.HasFlag(flag, includeDeAdmin); } /// /// See if a player has an admin flag. /// /// /// When used by the client, this only returns accurate results for the player's own session. /// /// /// Whether to check flags even for admins that are current de-adminned. /// /// True if the player is and admin and has the specified flags. bool HasAdminFlag(ICommonSession player, AdminFlags flag, bool includeDeAdmin = false) { var data = GetAdminData(player, includeDeAdmin); return data != null && data.HasFlag(flag, includeDeAdmin); } /// /// 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; } }