RemoveAccessSpecific() public method

public RemoveAccessSpecific ( System accessType, System sid, System rule ) : void
accessType System
sid System
rule System
return void
Example #1
0
		public void PropagationFlagsDoNotRequireInheritanceFlagsForRemoveSpecific ()
		{
			SecurityIdentifier sid = new SecurityIdentifier ("BU");
			DiscretionaryAcl dacl = new DiscretionaryAcl (false, false, 0);
			dacl.RemoveAccessSpecific (AccessControlType.Allow, sid, 3,
			                           InheritanceFlags.ContainerInherit, PropagationFlags.InheritOnly);
		}
Example #2
0
		void RemoveSpecificBegin (SecurityIdentifier sid, DiscretionaryAcl dacl, InheritanceFlags inheritanceFlags)
		{
			SecurityIdentifier otherSid = new SecurityIdentifier ("BU");

			dacl.AddAccess (AccessControlType.Allow, sid, 3, inheritanceFlags, PropagationFlags.None);
			Assert.AreEqual (1, dacl.Count);
			dacl.RemoveAccessSpecific (AccessControlType.Deny, sid, 1, inheritanceFlags, PropagationFlags.None);
			Assert.AreEqual (1, dacl.Count);
			dacl.RemoveAccessSpecific (AccessControlType.Allow, otherSid, 1, inheritanceFlags, PropagationFlags.None);
			Assert.AreEqual (1, dacl.Count);
			dacl.RemoveAccessSpecific (AccessControlType.Allow, sid, 1, inheritanceFlags, PropagationFlags.None);
			Assert.AreEqual (1, dacl.Count);
			Assert.AreEqual (3, ((CommonAce)dacl [0]).AccessMask);
			dacl.RemoveAccessSpecific (AccessControlType.Allow, sid, 3,
			                           inheritanceFlags ^ InheritanceFlags.ContainerInherit,
			                           PropagationFlags.None);
			Assert.AreEqual (1, dacl.Count);
		}
Example #3
0
		public void RemoveSpecificIsContainer ()
		{
			SecurityIdentifier sid = new SecurityIdentifier ("BA");
			DiscretionaryAcl dacl = new DiscretionaryAcl (true, false, 0);

			RemoveSpecificBegin (sid, dacl, InheritanceFlags.ObjectInherit);
			dacl.RemoveAccessSpecific (AccessControlType.Allow, sid, 3, InheritanceFlags.ObjectInherit, PropagationFlags.None);
			Assert.AreEqual (0, dacl.Count);
		}
Example #4
0
		public void RemoveSpecificIgnoresPropagationFlagsWhenMatchingInheritanceFlagsNone()
		{
			SecurityIdentifier sid = new SecurityIdentifier ("BA");
			DiscretionaryAcl dacl = new DiscretionaryAcl (false, false, 0);

			RemoveSpecificBegin (sid, dacl, InheritanceFlags.None);
			dacl.RemoveAccessSpecific (AccessControlType.Allow, sid, 3,
			                           InheritanceFlags.None, PropagationFlags.InheritOnly);
			Assert.AreEqual (0, dacl.Count);
		}
Example #5
0
		public void RemoveSpecificUsingDSOverload ()
		{
			SecurityIdentifier sid = new SecurityIdentifier ("BA");
			DiscretionaryAcl dacl = new DiscretionaryAcl (false, true, 0);

			RemoveSpecificBegin (sid, dacl, InheritanceFlags.None);
			dacl.RemoveAccessSpecific (AccessControlType.Allow, sid, 3, InheritanceFlags.None, PropagationFlags.None,
			                           ObjectAceFlags.ObjectAceTypePresent, Guid.Empty, Guid.Empty);
			Assert.AreEqual (1, dacl.Count);
			dacl.RemoveAccessSpecific (AccessControlType.Allow, sid, 3, InheritanceFlags.None, PropagationFlags.None,
			                           ObjectAceFlags.None, Guid.Empty, Guid.Empty);
			Assert.AreEqual (0, dacl.Count);
		}