Permissions panel.

This commit is contained in:
Pieter-Jan Briers
2020-11-10 16:50:28 +01:00
parent c9236d88ac
commit e39ddd4802
41 changed files with 3355 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Content.Shared.Administration;
using Robust.Server.Interfaces.Player;
@@ -11,6 +12,11 @@ namespace Content.Server.Administration
/// </summary>
public interface IAdminManager
{
/// <summary>
/// Fired when the permissions of an admin on the server changed.
/// </summary>
event Action<AdminPermsChangedEventArgs> OnPermsChanged;
/// <summary>
/// Gets all active admins currently on the server.
/// </summary>
@@ -29,6 +35,16 @@ namespace Content.Server.Administration
/// <returns><see langword="null" /> if the player is not an admin.</returns>
AdminData? GetAdminData(IPlayerSession session, bool includeDeAdmin = false);
/// <summary>
/// See if a player has an admin flag.
/// </summary>
/// <returns>True if the player is and admin and has the specified flags.</returns>
bool HasAdminFlag(IPlayerSession player, AdminFlags flag)
{
var data = GetAdminData(player);
return data != null && data.HasFlag(flag);
}
/// <summary>
/// De-admins an admin temporarily so they are effectively a normal player.
/// </summary>
@@ -42,6 +58,19 @@ namespace Content.Server.Administration
/// </summary>
void ReAdmin(IPlayerSession session);
/// <summary>
/// Re-loads the permissions of an player in case their admin data changed DB-side.
/// </summary>
/// <seealso cref="ReloadAdminsWithRank"/>
void ReloadAdmin(IPlayerSession player);
/// <summary>
/// Reloads admin permissions for all admins with a certain rank.
/// </summary>
/// <param name="rankId">The database ID of the rank.</param>
/// <seealso cref="ReloadAdmin"/>
void ReloadAdminsWithRank(int rankId);
void Initialize();
}
}