예제 #1
0
 public static SuplexAce FromSuplexNative(this Suplex.Forms.ObjectModel.Api.AccessControlEntryBase ace, DataRow r)
 {
     return(new SuplexAce()
     {
         SecurityPrincipal = r["ACE_TRUSTEE_USER_GROUP_NAME"].ToString(),
         Right = ace.Right.ToString(),
         Allowed = ace.Allowed
     });
 }
예제 #2
0
        public static ssa.IAccessControlEntry ToNewAce(this legacySplxApi.AccessControlEntryBase legacyAce, bool isAuditAce = false)
        {
            ssa.IAccessControlEntry newAce = null;

            switch (legacyAce.AceType)
            {
            case legacySplxSecurity.AceType.UI:
            {
                newAce = isAuditAce ? new ssa.AccessControlEntryAudit <ssa.UIRight>() : new ssa.AccessControlEntry <ssa.UIRight>();
                break;
            }

            case legacySplxSecurity.AceType.Record:
            {
                newAce = isAuditAce ? new ssa.AccessControlEntryAudit <ssa.RecordRight>() : new ssa.AccessControlEntry <ssa.RecordRight>();
                break;
            }

            case legacySplxSecurity.AceType.FileSystem:
            {
                newAce = isAuditAce ? new ssa.AccessControlEntryAudit <ssa.FileSystemRight>() : new ssa.AccessControlEntry <ssa.FileSystemRight>();
                break;
            }

            case legacySplxSecurity.AceType.Synchronization:
            {
                newAce = isAuditAce ? new ssa.AccessControlEntryAudit <ssa.SynchronizationRight>() : new ssa.AccessControlEntry <ssa.SynchronizationRight>();
                break;
            }
            }

            newAce.SetRight(legacyAce.Right.ToString());
            newAce.Allowed = legacyAce.Allowed;
            if (isAuditAce)
            {
                ((ssa.IAccessControlEntryAudit)newAce).Denied = ((legacySplxSecurity.IAccessControlEntryAudit)legacyAce).Denied;
            }
            newAce.Inheritable = legacyAce.Inherit;
            newAce.TrusteeUId  = Guid.Parse(legacyAce.SecurityPrincipalId);
            newAce.UId         = Guid.NewGuid(); //incompatible: legacyAce.Id;

            return(newAce);
        }