Core: refactor
This commit is contained in:
parent
e6f111f651
commit
fe15811c8f
@ -30,9 +30,5 @@ public interface ISecurityObjectId
|
||||
{
|
||||
object SecurityId { get; }
|
||||
Type ObjectType { get; }
|
||||
|
||||
string ToString()
|
||||
{
|
||||
return AzObjectIdHelper.GetFullObjectId(this);
|
||||
}
|
||||
string FullId { get; }
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public class SecurityObjectId : ISecurityObjectId
|
||||
{
|
||||
public object SecurityId { get; private set; }
|
||||
public Type ObjectType { get; private set; }
|
||||
public string FullId => AzObjectIdHelper.GetFullObjectId(this);
|
||||
|
||||
public SecurityObjectId(object id, Type objType)
|
||||
{
|
||||
|
@ -41,12 +41,12 @@ public class AzRecord : IMapFrom<Acl>
|
||||
{
|
||||
}
|
||||
|
||||
public AzRecord(Guid subjectId, Guid actionId, AceType reaction, string objectId)
|
||||
public AzRecord(Guid subjectId, Guid actionId, AceType reaction, string fullId)
|
||||
{
|
||||
Subject = subjectId;
|
||||
Action = actionId;
|
||||
AceType = reaction;
|
||||
Object = objectId;
|
||||
Object = fullId;
|
||||
}
|
||||
|
||||
public static implicit operator AzRecord(AzRecordCache cache)
|
||||
|
@ -29,6 +29,7 @@ public class UserSecurityProvider : ISecurityObject
|
||||
{
|
||||
public Type ObjectType { get; private set; }
|
||||
public object SecurityId { get; private set; }
|
||||
public string FullId => AzObjectIdHelper.GetFullObjectId(this);
|
||||
|
||||
public UserSecurityProvider(Guid userId)
|
||||
{
|
||||
|
@ -210,7 +210,7 @@ namespace ASC.Web.Core
|
||||
|
||||
// remove old aces
|
||||
AuthorizationManager.RemoveAllAces(securityObj);
|
||||
var allowToAll = new AzRecord(ASC.Core.Users.Constants.GroupEveryone.ID, Read.ID, AceType.Allow, securityObj.ToString());
|
||||
var allowToAll = new AzRecord(ASC.Core.Users.Constants.GroupEveryone.ID, Read.ID, AceType.Allow, securityObj.FullId);
|
||||
AuthorizationManager.RemoveAce(allowToAll);
|
||||
|
||||
// set new aces
|
||||
@ -225,7 +225,7 @@ namespace ASC.Web.Core
|
||||
}
|
||||
foreach (var s in subjects)
|
||||
{
|
||||
var a = new AzRecord(s, Read.ID, enabled ? AceType.Allow : AceType.Deny, securityObj.ToString());
|
||||
var a = new AzRecord(s, Read.ID, enabled ? AceType.Allow : AceType.Deny, securityObj.FullId);
|
||||
AuthorizationManager.AddAce(a);
|
||||
}
|
||||
|
||||
@ -370,6 +370,8 @@ namespace ASC.Web.Core
|
||||
get { return WebItemId.ToString("N"); }
|
||||
}
|
||||
|
||||
public string FullId => AzObjectIdHelper.GetFullObjectId(this);
|
||||
|
||||
public bool InheritSupported
|
||||
{
|
||||
get { return true; }
|
||||
@ -380,7 +382,6 @@ namespace ASC.Web.Core
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
|
||||
public static WebItemSecurityObject Create(string id, WebItemManager webItemManager)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
|
Loading…
Reference in New Issue
Block a user