protected AccessRule (IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : base (identity, accessMask, isInherited, inheritanceFlags, propagationFlags) { if (!(identity is SecurityIdentifier)) { throw new ArgumentException ("identity"); } if (type < AccessControlType.Allow || type > AccessControlType.Deny) { throw new ArgumentException ("type"); } if (accessMask == 0) { /* FIXME: check inheritance and * propagation flags too */ throw new ArgumentOutOfRangeException (); } this.type = type; }
public FileSystemAccessRule (String identity, FileSystemRights fileSystemRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : base(IdentityReference.IdentityFromName(identity), (int)fileSystemRights, false, inheritanceFlags, propagationFlags, type) {}
public FileSystemAuditRule (String identity, FileSystemRights fileSystemRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags auditFlags) : base(IdentityReference.IdentityFromName(identity), (int)fileSystemRights, false, inheritanceFlags, propagationFlags, auditFlags) {}
public void AddAccess(AccessControlType accessType, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { base.CheckAccessType(accessType); base.CheckFlags(inheritanceFlags, propagationFlags); this.everyOneFullAccessForNullDacl = false; base.AddQualifiedAce(sid, (accessType == AccessControlType.Allow) ? AceQualifier.AccessAllowed : AceQualifier.AccessDenied, accessMask, GenericAce.AceFlagsFromInheritanceFlags(inheritanceFlags, propagationFlags), ObjectAceFlags.None, Guid.Empty, Guid.Empty); }
internal static ActiveDirectorySecurityInheritance GetEffectiveInheritanceFlags(InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { ActiveDirectorySecurityInheritance activeDirectorySecurityInheritance = ActiveDirectorySecurityInheritance.None; if ((inheritanceFlags & InheritanceFlags.ContainerInherit) != InheritanceFlags.None) { PropagationFlags propagationFlag = propagationFlags; if (propagationFlag == PropagationFlags.None) { activeDirectorySecurityInheritance = ActiveDirectorySecurityInheritance.All; return activeDirectorySecurityInheritance; } else if (propagationFlag == PropagationFlags.NoPropagateInherit) { activeDirectorySecurityInheritance = ActiveDirectorySecurityInheritance.SelfAndChildren; return activeDirectorySecurityInheritance; } else if (propagationFlag == PropagationFlags.InheritOnly) { activeDirectorySecurityInheritance = ActiveDirectorySecurityInheritance.Descendents; return activeDirectorySecurityInheritance; } else if (propagationFlag == (PropagationFlags.NoPropagateInherit | PropagationFlags.InheritOnly)) { activeDirectorySecurityInheritance = ActiveDirectorySecurityInheritance.Children; return activeDirectorySecurityInheritance; } throw new ArgumentException("propagationFlags"); } return activeDirectorySecurityInheritance; }
public override sealed AccessRule AccessRuleFactory (IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) { return new FileSystemAccessRule (identityReference, (FileSystemRights) accessMask, isInherited, inheritanceFlags, propagationFlags, type); }
public override sealed AuditRule AuditRuleFactory (IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) { return new PipeAuditRule (identityReference, (PipeAccessRights)accessMask, flags); }
public override AccessRule AccessRuleFactory (IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) { return new PipeAccessRule (identityReference, (PipeAccessRights)accessMask, type); }
private static bool TestRemoveAudit(SystemAcl systemAcl, RawAcl rawAcl, AuditFlags auditFlag, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, bool removePossible) { bool result = true; bool isRemoved = false; byte[] sAclBinaryForm = null; byte[] rAclBinaryForm = null; isRemoved = systemAcl.RemoveAudit(auditFlag, sid, accessMask, inheritanceFlags, propagationFlags); if ((isRemoved == removePossible) && (systemAcl.Count == rawAcl.Count) && (systemAcl.BinaryLength == rawAcl.BinaryLength)) { sAclBinaryForm = new byte[systemAcl.BinaryLength]; rAclBinaryForm = new byte[rawAcl.BinaryLength]; systemAcl.GetBinaryForm(sAclBinaryForm, 0); rawAcl.GetBinaryForm(rAclBinaryForm, 0); if (!Utils.IsBinaryFormEqual(sAclBinaryForm, rAclBinaryForm)) result = false; //redundant index check for (int i = 0; i < systemAcl.Count; i++) { if (!Utils.IsAceEqual(systemAcl[i], rawAcl[i])) { result = false; break; } } } else result = false; return result; }
protected internal AuthorizationRule (IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { if (!(identity is SecurityIdentifier) && !(identity is NTAccount)) throw new ArgumentException ("identity"); // Unit testing showed that MS.NET 4.0 actually throws ArgumentException // for accessMask == 0, not the ArgumentOutOfRangeException specified. if (accessMask == 0) throw new ArgumentException ("accessMask"); if (0 != (inheritanceFlags & ~(InheritanceFlags.ContainerInherit|InheritanceFlags.ObjectInherit))) throw new ArgumentOutOfRangeException (); if (0 != (propagationFlags & ~(PropagationFlags.NoPropagateInherit|PropagationFlags.InheritOnly))) throw new ArgumentOutOfRangeException (); this.identity = identity; this.accessMask = accessMask; this.isInherited = isInherited; this.inheritanceFlags = inheritanceFlags; this.propagationFlags = propagationFlags; }
internal QualifiedAce (InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AceQualifier aceQualifier, bool isCallback, byte [] opaque) : base (inheritanceFlags, propagationFlags) { ace_qualifier = aceQualifier; is_callback = isCallback; SetOpaque (opaque); }
public virtual AuditRule AuditRuleFactory (IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags, Guid objectType, Guid inheritedObjectType) { throw GetNotImplementedException (); }
private static bool TestAddAccess(DiscretionaryAcl discretionaryAcl, RawAcl rawAcl, AccessControlType accessControlType, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { bool result = true; byte[] dAclBinaryForm = null; byte[] rAclBinaryForm = null; discretionaryAcl.AddAccess(accessControlType, sid, accessMask, inheritanceFlags, propagationFlags); if (discretionaryAcl.Count == rawAcl.Count && discretionaryAcl.BinaryLength == rawAcl.BinaryLength) { dAclBinaryForm = new byte[discretionaryAcl.BinaryLength]; rAclBinaryForm = new byte[rawAcl.BinaryLength]; discretionaryAcl.GetBinaryForm(dAclBinaryForm, 0); rawAcl.GetBinaryForm(rAclBinaryForm, 0); if (!Utils.IsBinaryFormEqual(dAclBinaryForm, rAclBinaryForm)) result = false; //redundant index check for (int i = 0; i < discretionaryAcl.Count; i++) { if (!Utils.IsAceEqual(discretionaryAcl[i], rawAcl[i])) { result = false; break; } } } else result = false; return result; }
public RegistryAccessRule (String identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : base(IdentityReference.IdentityFromName(identity), (int)registryRights, false, inheritanceFlags, propagationFlags, type) {}
private static void AddDirectorySecurity(string folderName, string account, FileSystemRights rights, InheritanceFlags inheritance, PropagationFlags propogation, AccessControlType controlType) { DirectoryInfo directoryInfo = new DirectoryInfo(folderName); DirectorySecurity accessControl = directoryInfo.GetAccessControl(); accessControl.AddAccessRule(new FileSystemAccessRule(account, rights, inheritance, propogation, controlType)); directoryInfo.SetAccessControl(accessControl); }
public RegistryAuditRule (String identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags auditFlags) : base(IdentityReference.IdentityFromName(identity), (int)registryRights, false, inheritanceFlags, propagationFlags, auditFlags) {}
public FileSystemAccessRule (string identity, FileSystemRights fileSystemRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : this (new NTAccount (identity), fileSystemRights, inheritanceFlags, propagationFlags, type) { }
public void AddAudit (AuditFlags auditFlags, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { // CommonAce? throw new NotImplementedException (); }
public bool RemoveAccess (AccessControlType accessType, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { throw new NotImplementedException (); }
public FileSystemAuditRule (IdentityReference identity, FileSystemRights fileSystemRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) : this (identity, fileSystemRights, false, inheritanceFlags, propagationFlags, flags) { }
public void RemoveAuditSpecific(AuditFlags auditFlags, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, ObjectAceFlags objectFlags, Guid objectType, Guid inheritedObjectType) { if (!base.IsDS) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_OnlyValidForDS")); } base.RemoveQualifiedAcesSpecific(sid, AceQualifier.SystemAudit, accessMask, (AceFlags) ((byte) (GenericAce.AceFlagsFromAuditFlags(auditFlags) | GenericAce.AceFlagsFromInheritanceFlags(inheritanceFlags, propagationFlags))), objectFlags, objectType, inheritedObjectType); }
public TestRule (IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) : base (identity, accessMask, isInherited, inheritanceFlags, propagationFlags) { }
public void AddAudit (AuditFlags auditFlags, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { AddAce (AceQualifier.SystemAudit, sid, accessMask, inheritanceFlags, propagationFlags, auditFlags); }
public RegistryAccessRule (IdentityReference identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : this (identity, registryRights, false, inheritanceFlags, propagationFlags, type) { }
public void AddAccess (AccessControlType accessType, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { throw new NotImplementedException (); // CommonAce? }
public RegistryAccessRule (string identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : this (new NTAccount (identity), registryRights, inheritanceFlags, propagationFlags, type) { }
public FileSystemAccessRule (IdentityReference identity, FileSystemRights fileSystemRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : this (identity, fileSystemRights, false, inheritanceFlags, propagationFlags, type) { }
public FileSystemAuditRule (string identity, FileSystemRights fileSystemRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) : this (new SecurityIdentifier (identity), fileSystemRights, inheritanceFlags, propagationFlags, flags) { }
public void AddAudit(AuditFlags auditFlags, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, ObjectAceFlags objectFlags, Guid objectType, Guid inheritedObjectType) { // TODO }
public bool RemoveAudit (AuditFlags auditFlags, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { throw new NotImplementedException (); }
public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) { throw new NotImplementedException(); }
public RegistryAccessRule(IdentityReference identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : this(identity, (int)registryRights, false, inheritanceFlags, propagationFlags, type) { }
/// <summary>Creates a new audit rule, specifying the user the rule applies to, the access rights to audit, and the outcome that triggers the audit rule.</summary> /// <returns>An <see cref="T:System.Security.AccessControl.EventWaitHandleAuditRule" /> object representing the specified audit rule for the specified user. The return type of the method is the base class, <see cref="T:System.Security.AccessControl.AuditRule" />, but the return value can be cast safely to the derived class.</returns> /// <param name="identityReference">An <see cref="T:System.Security.Principal.IdentityReference" /> that identifies the user or group the rule applies to.</param> /// <param name="accessMask">A bitwise combination of <see cref="T:System.Security.AccessControl.EventWaitHandleRights" /> values specifying the access rights to audit, cast to an integer.</param> /// <param name="isInherited">Meaningless for named wait handles, because they have no hierarchy.</param> /// <param name="inheritanceFlags">Meaningless for named wait handles, because they have no hierarchy.</param> /// <param name="propagationFlags">Meaningless for named wait handles, because they have no hierarchy.</param> /// <param name="flags">A bitwise combination of <see cref="T:System.Security.AccessControl.AuditFlags" /> values specifying whether to audit successful access, failed access, or both.</param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="accessMask" />, <paramref name="inheritanceFlags" />, <paramref name="propagationFlags" />, or <paramref name="flags" /> specifies an invalid value.</exception> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="identityReference" /> is null. -or-<paramref name="accessMask" /> is zero.</exception> /// <exception cref="T:System.ArgumentException"> /// <paramref name="identityReference" /> is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" />, nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception> public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) { return(new EventWaitHandleAuditRule(identityReference, (EventWaitHandleRights)accessMask, flags)); }
public RegistryAuditRule(IdentityReference identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) : this(identity, (int)registryRights, false, inheritanceFlags, propagationFlags, flags) { }
internal RegistryAuditRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) : base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, flags) { }
public static FileSystemAccessRule2 AddFileSystemAccessRule(string path, IdentityReference2 account, FileSystemRights2 rights, AccessControlType type, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { if (type == AccessControlType.Allow) { rights = rights | FileSystemRights2.Synchronize; } FileSystemAccessRule ace = null; if (File.Exists(path)) { var item = new FileInfo(path); ace = AddFileSystemAccessRule(item, account, rights, type, inheritanceFlags, propagationFlags); } else { var item = new DirectoryInfo(path); ace = AddFileSystemAccessRule(item, account, rights, type, inheritanceFlags, propagationFlags); } return(ace); }
public static IEnumerable <FileSystemAccessRule2> AddFileSystemAccessRule(FileSystemSecurity2 sd, List <IdentityReference2> accounts, FileSystemRights2 rights, AccessControlType type, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { var aces = new List <FileSystemAccessRule2>(); foreach (var account in accounts) { aces.Add(AddFileSystemAccessRule(sd, account, rights, type, inheritanceFlags, propagationFlags)); } return(aces); }
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); }
public virtual AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) { return(_fileSystemSecurity.AuditRuleFactory(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, flags)); }
public virtual AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) { return(_fileSystemSecurity.AccessRuleFactory(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, type)); }
public override sealed AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) { // FIXME: isInherited is unused return(new FileSystemAuditRule(identityReference, (FileSystemRights)accessMask, inheritanceFlags, propagationFlags, flags)); }
public RegistryAuditRule(string identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) : this(new NTAccount(identity), (int)registryRights, false, inheritanceFlags, propagationFlags, flags) { }
public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) { throw new NotImplementedException(); }
private static bool TestRemoveAudit(SystemAcl systemAcl, RawAcl rawAcl, AuditFlags auditFlag, SecurityIdentifier sid, int accessMask, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, bool removePossible) { bool result = true; bool isRemoved = false; byte[] sAclBinaryForm = null; byte[] rAclBinaryForm = null; isRemoved = systemAcl.RemoveAudit(auditFlag, sid, accessMask, inheritanceFlags, propagationFlags); if ((isRemoved == removePossible) && (systemAcl.Count == rawAcl.Count) && (systemAcl.BinaryLength == rawAcl.BinaryLength)) { sAclBinaryForm = new byte[systemAcl.BinaryLength]; rAclBinaryForm = new byte[rawAcl.BinaryLength]; systemAcl.GetBinaryForm(sAclBinaryForm, 0); rawAcl.GetBinaryForm(rAclBinaryForm, 0); if (!Utils.IsBinaryFormEqual(sAclBinaryForm, rAclBinaryForm)) { result = false; } //redundant index check for (int i = 0; i < systemAcl.Count; i++) { if (!Utils.IsAceEqual(systemAcl[i], rawAcl[i])) { result = false; break; } } } else { result = false; } return(result); }
public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) { return(new RegistryAccessRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, type)); }
public RegistryAccessRule(string identity, RegistryRights registryRights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : this(new NTAccount(identity), (int)registryRights, false, inheritanceFlags, propagationFlags, type) { }
internal RegistryAccessRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) : base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, type) { }
public static Boolean ReplaceFileSecurity(string File, string[] Account, FileSystemRights Rights, AccessControlType ControlType, InheritanceFlags Inherit, PropagationFlags Propagation) { FileInfo fInfo = new FileInfo(File); FileSecurity fSecurity = fInfo.GetAccessControl(); try { fSecurity.SetAccessRuleProtection(true, false); foreach (string account in Account) { fSecurity.ResetAccessRule(new FileSystemAccessRule(account, Rights, Inherit, Propagation, ControlType)); } fInfo.SetAccessControl(fSecurity); } catch (Exception ex) { LibraryLogging.Error("unable to ReplaceFileSecurity for {0} error {1}", File, ex.Message); return(false); } return(true); }
public static Boolean ReplaceDirectorySecurity(string dir, string[] Account, FileSystemRights Rights, AccessControlType ControlType, InheritanceFlags Inherit, PropagationFlags Propagation) { DirectoryInfo dInfo = new DirectoryInfo(dir); DirectorySecurity dSecurity = new DirectorySecurity(); try { dSecurity.SetAccessRuleProtection(true, false); foreach (string account in Account) { dSecurity.ResetAccessRule(new FileSystemAccessRule(account, Rights, Inherit, Propagation, ControlType)); } dInfo.SetAccessControl(dSecurity); } catch (Exception ex) { LibraryLogging.Error("unable to ReplaceDirectorySecurity for {0} error {1}", dir, ex.Message); return(false); } return(true); }
public static Boolean SetDirectorySecurity(string dir, IdentityReference[] Account, FileSystemRights Rights, AccessControlType ControlType, InheritanceFlags Inherit, PropagationFlags Propagation) { DirectoryInfo dInfo = new DirectoryInfo(dir); DirectorySecurity dSecurity = dInfo.GetAccessControl(); try { foreach (IdentityReference account in Account) { dSecurity.AddAccessRule(new FileSystemAccessRule(account, Rights, Inherit, Propagation, ControlType)); } dInfo.SetAccessControl(dSecurity); } catch (Exception ex) { LibraryLogging.Error("unable to SetDirectorySecurity for {0} error {1}", dir, ex.Message); return(false); } return(true); }
/// <summary>Creates a new access control rule for the specified user, with the specified access rights, access control, and flags.</summary> /// <returns>An <see cref="T:System.Security.AccessControl.EventWaitHandleAccessRule" /> object representing the specified rights for the specified user.</returns> /// <param name="identityReference">An <see cref="T:System.Security.Principal.IdentityReference" /> that identifies the user or group the rule applies to.</param> /// <param name="accessMask">A bitwise combination of <see cref="T:System.Security.AccessControl.EventWaitHandleRights" /> values specifying the access rights to allow or deny, cast to an integer.</param> /// <param name="isInherited">Meaningless for named wait handles, because they have no hierarchy.</param> /// <param name="inheritanceFlags">Meaningless for named wait handles, because they have no hierarchy.</param> /// <param name="propagationFlags">Meaningless for named wait handles, because they have no hierarchy.</param> /// <param name="type">One of the <see cref="T:System.Security.AccessControl.AccessControlType" /> values specifying whether the rights are allowed or denied.</param> /// <exception cref="T:System.ArgumentOutOfRangeException"> /// <paramref name="accessMask" />, <paramref name="inheritanceFlags" />, <paramref name="propagationFlags" />, or <paramref name="type" /> specifies an invalid value.</exception> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="identityReference" /> is null. -or-<paramref name="accessMask" /> is zero.</exception> /// <exception cref="T:System.ArgumentException"> /// <paramref name="identityReference" /> is neither of type <see cref="T:System.Security.Principal.SecurityIdentifier" />, nor of a type such as <see cref="T:System.Security.Principal.NTAccount" /> that can be converted to type <see cref="T:System.Security.Principal.SecurityIdentifier" />.</exception> public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) { return(new EventWaitHandleAccessRule(identityReference, (EventWaitHandleRights)accessMask, type)); }
public override AuditRule Constructor(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags AuditFlags) { return(new FileSystemAuditRule(identityReference, FileSystemRights.Read, inheritanceFlags, propagationFlags, AuditFlags)); }
public override sealed AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) { // FIXME: isInherited is unused return(new FileSystemAccessRule(identityReference, (FileSystemRights)accessMask, inheritanceFlags, propagationFlags, type)); }
public abstract AuditRule Constructor(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags AuditFlags);
public static FileSystemAccessRule2 AddFileSystemAccessRule(FileSystemSecurity2 sd, IdentityReference2 account, FileSystemRights2 rights, AccessControlType type, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { if (type == AccessControlType.Allow) { rights = rights | FileSystemRights2.Synchronize; } FileSystemAccessRule ace = null; if (sd.IsFile) { ace = (FileSystemAccessRule)sd.SecurityDescriptor.AccessRuleFactory(account, (int)rights, false, InheritanceFlags.None, PropagationFlags.None, type); ((FileSecurity)sd.SecurityDescriptor).AddAccessRule(ace); } else { ace = (FileSystemAccessRule)sd.SecurityDescriptor.AccessRuleFactory(account, (int)rights, false, inheritanceFlags, propagationFlags, type); ((DirectorySecurity)sd.SecurityDescriptor).AddAccessRule(ace); } return(ace); }
public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) { return(new RegistryAuditRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, flags)); }
public override sealed AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags) { return(new CryptoKeyAuditRule(identityReference, (CryptoKeyRights)accessMask, flags)); }
public virtual AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags, Guid objectType, Guid inheritedObjectType) { throw new NotImplementedException(); }
public static IEnumerable <FileSystemAccessRule2> AddFileSystemAccessRule(string path, List <IdentityReference2> accounts, FileSystemRights2 rights, AccessControlType type, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags) { if (type == AccessControlType.Allow) { rights = rights | FileSystemRights2.Synchronize; } if (File.Exists(path)) { var item = new FileInfo(path); foreach (var account in accounts) { yield return(AddFileSystemAccessRule(item, account, rights, type, inheritanceFlags, propagationFlags)); } } else { var item = new DirectoryInfo(path); foreach (var account in accounts) { yield return(AddFileSystemAccessRule(item, account, rights, type, inheritanceFlags, propagationFlags)); } } }
public override sealed AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type) { return(new CryptoKeyAccessRule(identityReference, (CryptoKeyRights)accessMask, type)); }