AccessReader IsAllowed use resolve (#8527)

This commit is contained in:
keronshb
2022-06-01 11:26:50 -04:00
committed by GitHub
parent 7f984792a1
commit d5620aa833
11 changed files with 43 additions and 39 deletions

View File

@@ -116,7 +116,7 @@ namespace Content.Server.AI.Pathfinding
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
foreach (var reader in node.AccessReaders)
{
if (!accessSystem.IsAllowed(reader, access))
if (!accessSystem.IsAllowed(access, reader))
{
return false;
}

View File

@@ -232,7 +232,7 @@ public sealed partial class PathfindingSystem
var access = _accessReader.FindAccessTags(entity);
foreach (var reader in node.AccessReaders)
{
if (!_accessReader.IsAllowed(reader, access))
if (!_accessReader.IsAllowed(access, reader))
{
return false;
}

View File

@@ -56,7 +56,7 @@ namespace Content.Server.Access.Components
var privilegedIdEntity = PrivilegedIdSlot.Item;
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
return privilegedIdEntity != null && accessSystem.IsAllowed(reader, privilegedIdEntity.Value);
return privilegedIdEntity != null && accessSystem.IsAllowed(privilegedIdEntity.Value, reader);
}
/// <summary>

View File

@@ -258,7 +258,7 @@ namespace Content.Server.Atmos.Monitor.Systems
if (!EntityManager.TryGetComponent(uid, out AccessReaderComponent reader) || user == null)
return false;
if (!_accessSystem.IsAllowed(reader, user.Value))
if (!_accessSystem.IsAllowed(user.Value, reader))
{
_popup.PopupEntity(Loc.GetString("air-alarm-ui-access-denied"), user.Value, Filter.Entities(user.Value));
return false;

View File

@@ -190,7 +190,7 @@ namespace Content.Server.Cargo
public bool ApproveOrder(EntityUid uid, EntityUid approver, int id, int orderNumber, AccessReaderComponent? reader = null)
{
// does the approver have permission to approve orders?
if (Resolve(uid, ref reader) && !_accessReaderSystem.IsAllowed(reader, approver))
if (Resolve(uid, ref reader) && !_accessReaderSystem.IsAllowed(approver, reader))
return false;
// get the approver's name

View File

@@ -217,9 +217,9 @@ public sealed class DoorSystem : SharedDoorSystem
return AccessType switch
{
// Some game modes modify access rules.
AccessTypes.AllowAllIdExternal => !isExternal || _accessReaderSystem.IsAllowed(access, user.Value),
AccessTypes.AllowAllIdExternal => !isExternal || _accessReaderSystem.IsAllowed(user.Value, access),
AccessTypes.AllowAllNoExternal => !isExternal,
_ => _accessReaderSystem.IsAllowed(access, user.Value)
_ => _accessReaderSystem.IsAllowed(user.Value, access)
};
}

View File

@@ -156,7 +156,7 @@ namespace Content.Server.Lock
if (!Resolve(uid, ref reader))
return true;
if (!_accessReader.IsAllowed(reader, user))
if (!_accessReader.IsAllowed(user, reader))
{
if (!quiet)
reader.Owner.PopupMessage(user, Loc.GetString("lock-comp-has-user-access-fail"));

View File

@@ -48,7 +48,7 @@ namespace Content.Server.Power.EntitySystems
if (args.Session.AttachedEntity == null)
return;
if (access == null || _accessReader.IsAllowed(access, args.Session.AttachedEntity.Value))
if (access == null || _accessReader.IsAllowed(args.Session.AttachedEntity.Value, access))
{
ApcToggleBreaker(uid, component);
}

View File

@@ -175,7 +175,7 @@ namespace Content.Server.VendingMachines
if (TryComp<AccessReaderComponent?>(vendComponent.Owner, out var accessReader))
{
if (!_accessReader.IsAllowed(accessReader, sender.Value) && !vendComponent.Emagged)
if (!_accessReader.IsAllowed(sender.Value, accessReader) && !vendComponent.Emagged)
{
_popupSystem.PopupEntity(Loc.GetString("vending-machine-component-try-eject-access-denied"), uid, Filter.Pvs(uid));
Deny(uid, vendComponent);