2022-02-03 15:26:44 +00:00
|
|
|
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);
|
2022-02-03 15:26:44 +00:00
|
|
|
|
|
|
|
public SecurityObjectId(object id, Type objType)
|
|
|
|
{
|
2022-03-09 17:15:51 +00:00
|
|
|
ArgumentNullException.ThrowIfNull(objType);
|
|
|
|
|
2022-02-03 15:26:44 +00:00
|
|
|
SecurityId = id;
|
2022-03-09 17:15:51 +00:00
|
|
|
ObjectType = objType;
|
2022-02-03 15:26:44 +00:00
|
|
|
}
|
|
|
|
|
2022-02-08 11:07:28 +00:00
|
|
|
public override int GetHashCode()
|
|
|
|
{
|
|
|
|
return AzObjectIdHelper.GetFullObjectId(this).GetHashCode();
|
|
|
|
}
|
2022-02-03 15:26:44 +00:00
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|