Beispiel #1
0
        protected override void WriteResult(IConfigurable dataObject)
        {
            TaskLogger.LogEnter();
            base.HasObjectMatchingIdentity = true;
            ActiveDirectorySecurity activeDirectorySecurity = PermissionTaskHelper.ReadAdSecurityDescriptor((ADRawEntry)dataObject, (IConfigurationSession)base.DataSession, new Task.TaskErrorLoggingDelegate(base.WriteError));

            if (!base.Owner.IsPresent)
            {
                AuthorizationRuleCollection accessRules = activeDirectorySecurity.GetAccessRules(true, true, typeof(SecurityIdentifier));
                int num = 0;
                while (accessRules.Count > num)
                {
                    ActiveDirectoryAccessRule activeDirectoryAccessRule = (ActiveDirectoryAccessRule)accessRules[num];
                    if (base.SecurityPrincipal == null || (base.SecurityPrincipal != null && base.SecurityPrincipal == activeDirectoryAccessRule.IdentityReference))
                    {
                        ADAcePresentationObject adacePresentationObject = new ADAcePresentationObject(activeDirectoryAccessRule, ((ADRawEntry)dataObject).Id);
                        adacePresentationObject.ResetChangeTracking(true);
                        base.WriteResult(adacePresentationObject);
                    }
                    num++;
                }
            }
            else
            {
                IdentityReference owner = activeDirectorySecurity.GetOwner(typeof(NTAccount));
                base.WriteResult(new OwnerPresentationObject(((ADRawEntry)dataObject).Id, owner.ToString()));
            }
            TaskLogger.LogExit();
        }
 protected override void WriteAces(ADObjectId id, IEnumerable <ActiveDirectoryAccessRule> aces)
 {
     foreach (ActiveDirectoryAccessRule ace in aces)
     {
         ADAcePresentationObject adacePresentationObject = new ADAcePresentationObject(ace, id);
         adacePresentationObject.ResetChangeTracking(true);
         base.WriteObject(adacePresentationObject);
     }
 }