public static void DisableAuditInheritance(FileSystemInfo item, bool removeInheritedAccessRules)
        {
            var sd = new FileSystemSecurity2(item, AccessControlSections.Audit);

            DisableAuditInheritance(sd, removeInheritedAccessRules);
            sd.Write();
        }
        public static void EnableAccessInheritance(FileSystemInfo item, bool removeExplicitAccessRules)
        {
            var sd = new FileSystemSecurity2(item, AccessControlSections.Access);

            EnableAccessInheritance(sd, removeExplicitAccessRules);
            sd.Write();
        }
        public static void RemoveFileSystemAccessRuleAll(FileSystemInfo item, List <IdentityReference2> accounts = null)
        {
            var sd = new FileSystemSecurity2(item);

            RemoveFileSystemAccessRuleAll(sd, accounts);

            sd.Write();
        }
Example #4
0
        public static void SetOwner(FileSystemInfo item, IdentityReference2 account)
        {
            var sd = new FileSystemSecurity2(item, AccessControlSections.Owner);

            SetOwner(sd, account);

            sd.Write();
        }
        public static FileSystemAuditRule2 AddFileSystemAuditRule(FileSystemInfo item, IdentityReference2 account, FileSystemRights2 rights, AuditFlags type, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags)
        {
            var sd = new FileSystemSecurity2(item);

            var ace = AddFileSystemAuditRule(sd, account, rights, type, inheritanceFlags, propagationFlags);

            sd.Write();

            return(ace);
        }
Example #6
0
        public static FileSystemAccessRule2 AddFileSystemAccessRule(FileSystemInfo item, IdentityReference2 account, FileSystemRights2 rights, AccessControlType type, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags)
        {
            if (type == AccessControlType.Allow)
            {
                rights = rights | FileSystemRights2.Synchronize;
            }

            var sd = new FileSystemSecurity2(item);

            var ace = AddFileSystemAccessRule(sd, account, rights, type, inheritanceFlags, propagationFlags);

            sd.Write();

            return(ace);
        }