Access refactor

Access is now done through a list of access lists, instead of the necessary/sufficient system that was extremely confusing.

Added a "deny" list so you can screw over sec.

Cleaned the API up so it all uses sets and such.

PDA now relays access read-only to fix edge cases.
This commit is contained in:
Pieter-Jan Briers
2020-06-03 11:46:59 +02:00
parent 49d96e3575
commit 0f43e5e6ad
11 changed files with 424 additions and 151 deletions

View File

@@ -1,11 +1,34 @@
using System;
using Content.Server.GameObjects.Components.Access;
using System.Collections.Generic;
#nullable enable
namespace Content.Server.Interfaces
{
/// <summary>
/// Contains access levels that can be checked to see if somebody has access with an <see cref="AccessReader"/>.
/// </summary>
public interface IAccess
{
public List<string> GetTags();
/// <summary>
/// The set of access tags this thing has.
/// </summary>
/// <remarks>
/// This set may be read-only. Check <see cref="IsReadOnly"/> if you want to mutate it.
/// </remarks>
ISet<string> Tags { get; }
public void SetTags(List<string> newTags);
/// <summary>
/// Whether the <see cref="Tags"/> list is read-only.
/// </summary>
bool IsReadOnly { get; }
/// <summary>
/// Replaces the set of access tags we have with the provided set.
/// </summary>
/// <param name="newTags">The new access tags</param>
/// <exception cref="NotSupportedException">If this access tag list is read-only.</exception>
void SetTags(IEnumerable<string> newTags);
}
}