示例#1
0
        private static void SetAces(Task.TaskVerboseLoggingDelegate verboseLogger, Task.TaskWarningLoggingDelegate warningLogger, Task.ErrorLoggerDelegate errorLogger, ADObject obj, bool remove, params ActiveDirectoryAccessRule[] aces)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }
            RawSecurityDescriptor rawSecurityDescriptor = obj.ReadSecurityDescriptor();

            rawSecurityDescriptor = DirectoryCommon.ApplyAcesOnSd(verboseLogger, warningLogger, errorLogger, obj.Id, rawSecurityDescriptor, remove, aces);
            if (rawSecurityDescriptor != null)
            {
                obj.SaveSecurityDescriptor(rawSecurityDescriptor);
            }
        }
示例#2
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);
            }
        }