DocSpace-buildtools/common/ASC.Common/Security/SecurityObjectId.cs

28 lines
857 B
C#
Raw Normal View History

namespace ASC.Common.Security;
[DebuggerDisplay("ObjectType: {ObjectType.Name}, SecurityId: {SecurityId}")]
public class SecurityObjectId : ISecurityObjectId
{
public object SecurityId { get; private set; }
public Type ObjectType { get; private set; }
2022-02-28 09:06:06 +00:00
public string FullId => AzObjectIdHelper.GetFullObjectId(this);
public SecurityObjectId(object id, Type objType)
{
2022-03-09 17:15:51 +00:00
ArgumentNullException.ThrowIfNull(objType);
SecurityId = id;
2022-03-09 17:15:51 +00:00
ObjectType = objType;
}
2022-02-08 11:07:28 +00:00
public override int GetHashCode()
{
return AzObjectIdHelper.GetFullObjectId(this).GetHashCode();
}
2022-02-08 11:07:28 +00:00
public override bool Equals(object obj)
{
return obj is SecurityObjectId other &&
Equals(AzObjectIdHelper.GetFullObjectId(other), AzObjectIdHelper.GetFullObjectId(this));
}
}