Exemple #1
0
        public static ActiveDirectorySecurity ReadAdSecurityDescriptor(ADRawEntry entry, IDirectorySession session, Task.TaskErrorLoggingDelegate logError, out RawSecurityDescriptor rawSd)
        {
            TaskLogger.LogEnter();
            rawSd = session.ReadSecurityDescriptor(entry.Id);
            if (rawSd == null)
            {
                if (logError != null)
                {
                    logError(new SecurityDescriptorAccessDeniedException(entry.Id.DistinguishedName), ErrorCategory.ReadError, null);
                }
                return(null);
            }
            ActiveDirectorySecurity result = SecurityDescriptorConverter.ConvertToActiveDirectorySecurity(rawSd);

            TaskLogger.LogExit();
            return(result);
        }
        // Token: 0x06001A7D RID: 6781 RVA: 0x0006EDC8 File Offset: 0x0006CFC8
        public virtual Result <TEntry> ReadSecurityDescriptor(ProxyAddress proxyAddress)
        {
            if (proxyAddress == null)
            {
                throw new ArgumentNullException("proxyAddress");
            }
            Result <TEntry> result = this.FindAndCacheRecipient(proxyAddress);

            if (result.Data != null)
            {
                IDirectorySession     adsession             = this.ADSession;
                TEntry                data                  = result.Data;
                RawSecurityDescriptor rawSecurityDescriptor = adsession.ReadSecurityDescriptor(data.Id);
                lock (result.Data)
                {
                    result.Data.propertyBag.SetField(ADObjectSchema.NTSecurityDescriptor, SecurityDescriptor.FromRawSecurityDescriptor(rawSecurityDescriptor));
                }
            }
            return(result);
        }
Exemple #3
0
        private static void SetAces(Task.TaskVerboseLoggingDelegate verboseLogger, Task.TaskWarningLoggingDelegate warningLogger, Task.ErrorLoggerDelegate errorLogger, IDirectorySession session, ADObjectId id, bool remove, params ActiveDirectoryAccessRule[] aces)
        {
            if (verboseLogger != null)
            {
                verboseLogger(Strings.InfoSetAces(id.DistinguishedName));
            }
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            RawSecurityDescriptor rawSecurityDescriptor = session.ReadSecurityDescriptor(id);

            rawSecurityDescriptor = DirectoryCommon.ApplyAcesOnSd(verboseLogger, warningLogger, errorLogger, id, rawSecurityDescriptor, remove, aces);
            if (rawSecurityDescriptor != null)
            {
                session.SaveSecurityDescriptor(id, rawSecurityDescriptor);
            }
        }
Exemple #4
0
 public static bool FindAces(IDirectorySession session, ADObjectId id, params ActiveDirectoryAccessRule[] aces)
 {
     return(DirectoryCommon.FindAces(id, session.ReadSecurityDescriptor(id), aces));
 }