当前位置: 首页>>代码示例>>C#>>正文


C# AccessControl.DiscretionaryAcl类代码示例

本文整理汇总了C#中System.Security.AccessControl.DiscretionaryAcl的典型用法代码示例。如果您正苦于以下问题:C# DiscretionaryAcl类的具体用法?C# DiscretionaryAcl怎么用?C# DiscretionaryAcl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DiscretionaryAcl类属于System.Security.AccessControl命名空间,在下文中一共展示了DiscretionaryAcl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateAllowEveryoneFullAccess

 internal static DiscretionaryAcl CreateAllowEveryoneFullAccess(bool isDS, bool isContainer)
 {
     DiscretionaryAcl acl = new DiscretionaryAcl(isContainer, isDS, 1);
     acl.AddAccess(AccessControlType.Allow, _sidEveryone, -1, isContainer ? (InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit) : InheritanceFlags.None, PropagationFlags.None);
     acl.everyOneFullAccessForNullDacl = true;
     return acl;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:DiscretionaryAcl.cs

示例2: AuthUserStartStop

        private static void AuthUserStartStop(DiscretionaryAcl dacl)
        {
            var sid = new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null);

            dacl.SetAccess(AccessControlType.Allow, sid, (int) (ServiceAccess.ServiceStart | ServiceAccess.ServiceStop),
                           InheritanceFlags.None, PropagationFlags.None);
        }
开发者ID:Jabe,项目名称:procstub,代码行数:7,代码来源:Program.cs

示例3: ObjectSecurity

 protected ObjectSecurity( bool isContainer, bool isDS )
     : this()
 {
     // we will create an empty DACL, denying anyone any access as the default. 5 is the capacity.
     DiscretionaryAcl dacl = new DiscretionaryAcl(isContainer, isDS, 5);
      _securityDescriptor = new CommonSecurityDescriptor( isContainer, isDS, ControlFlags.None, null, null, null, dacl );
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:ObjectSecurity.cs

示例4: NullRawAclRevisionOK

		public void NullRawAclRevisionOK ()
		{
			DiscretionaryAcl dacl1 = new DiscretionaryAcl (false, false, null);
			Assert.AreEqual (2, dacl1.Revision);

			DiscretionaryAcl dacl2 = new DiscretionaryAcl (false, true, null);
			Assert.AreEqual (4, dacl2.Revision);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CommonAclTest.cs

示例5: IpcStore

 static IpcStore()
 {
     var dacl = new DiscretionaryAcl(false, false, 1);
     dacl.AddAccess(AccessControlType.Allow, new SecurityIdentifier(WellKnownSidType.CreatorOwnerSid, null), -1, InheritanceFlags.None, PropagationFlags.None);
     dacl.AddAccess(AccessControlType.Allow, new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null), -1, InheritanceFlags.None, PropagationFlags.None);
     dacl.AddAccess(AccessControlType.Allow, new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null), -1, InheritanceFlags.None, PropagationFlags.None);
     IpcAcl = new CommonSecurityDescriptor(false, false, ControlFlags.GroupDefaulted | ControlFlags.OwnerDefaulted | ControlFlags.DiscretionaryAclPresent, null, null, null, dacl);
 }
开发者ID:0install,项目名称:0install-win,代码行数:8,代码来源:IpcStore.Connection.cs

示例6: AddAccessObjectAceNonDSFailsEvenIfObjectAceFlagsNoneImplyingCommonAce

		public void AddAccessObjectAceNonDSFailsEvenIfObjectAceFlagsNoneImplyingCommonAce ()
		{
			SecurityIdentifier sid = new SecurityIdentifier ("BA");
			DiscretionaryAcl dacl = new DiscretionaryAcl (false, false, 0);

			dacl.AddAccess (AccessControlType.Allow, sid, 1, InheritanceFlags.None, PropagationFlags.None,
			                ObjectAceFlags.None, Guid.Empty, Guid.Empty);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:DiscretionaryAclTest.cs

示例7: CommonSecurityDescriptor

		public CommonSecurityDescriptor (bool isContainer, bool isDS,
						 ControlFlags flags,
						 SecurityIdentifier owner,
						 SecurityIdentifier group,
						 SystemAcl systemAcl,
						 DiscretionaryAcl discretionaryAcl)
		{
			Init (isContainer, isDS, flags, owner, group, systemAcl, discretionaryAcl);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:9,代码来源:CommonSecurityDescriptor.cs

示例8: UsesRawAclRevision

		public void UsesRawAclRevision ()
		{
			RawAcl acl1 = new RawAcl (RawAcl.AclRevisionDS, 0);
			DiscretionaryAcl dacl1 = new DiscretionaryAcl (false, false, acl1);
			Assert.AreEqual (4, dacl1.Revision);

			RawAcl acl2 = new RawAcl (RawAcl.AclRevision, 0);
			DiscretionaryAcl dacl2 = new DiscretionaryAcl (false, true, acl2);
			Assert.AreEqual (2, dacl2.Revision);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:CommonAclTest.cs

示例9: EmptyBinaryFormDSOK

		public void EmptyBinaryFormDSOK()
		{
			DiscretionaryAcl dacl = new DiscretionaryAcl (false, true, 0);
			byte[] buffer = new byte[8];
			dacl.GetBinaryForm (buffer, 0);

			Assert.AreEqual (4, buffer [0]); // Revision
			Assert.AreEqual (8, ToUInt16 (buffer, 2)); // ACL Size
			Assert.AreEqual (0, ToUInt16 (buffer, 4)); // ACE Count
		}
开发者ID:adbre,项目名称:mono,代码行数:10,代码来源:CommonAclTest.cs

示例10: EditDacl

 private static void EditDacl(DiscretionaryAcl dacl, SecurityIdentifier account, int right, bool add)
 {
     if (add)
     {
         dacl.AddAccess(AccessControlType.Allow, account, right, InheritanceFlags.None, PropagationFlags.None);
     }
     else
     {
         dacl.RemoveAccess(AccessControlType.Allow, account, right, InheritanceFlags.None, PropagationFlags.None);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:Utility.cs

示例11: CreateSecurityDescriptor

 internal static CommonSecurityDescriptor CreateSecurityDescriptor(SecurityIdentifier userSid)
 {
     SecurityIdentifier sid = new SecurityIdentifier(networkSidSddlForm);
     DiscretionaryAcl dacl = new DiscretionaryAcl(false, false, 1);
     // Deny all access to NetworkSid
     dacl.AddAccess(AccessControlType.Deny, sid, -1, InheritanceFlags.None, PropagationFlags.None);
     if (userSid != null)
         dacl.AddAccess(AccessControlType.Allow, userSid, -1, InheritanceFlags.None, PropagationFlags.None);
     // Add access to the current user creating the pipe
     dacl.AddAccess(AccessControlType.Allow, WindowsIdentity.GetCurrent().User, -1, InheritanceFlags.None, PropagationFlags.None);
     // Initialize and return the CommonSecurityDescriptor
     return new CommonSecurityDescriptor(false, false, ControlFlags.OwnerDefaulted | ControlFlags.GroupDefaulted | ControlFlags.DiscretionaryAclPresent, null, null, null, dacl);;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:IpcPort.cs

示例12: AddAccessCommonAce

		public void AddAccessCommonAce ()
		{
			SecurityIdentifier sid = new SecurityIdentifier ("BA");
			DiscretionaryAcl dacl = new DiscretionaryAcl (false, false, 0);

			dacl.AddAccess (AccessControlType.Allow, sid, 1, InheritanceFlags.None, PropagationFlags.None);
			Assert.AreEqual (1, dacl.Count);

			CommonAce ace = (CommonAce)dacl[0];
			Assert.AreEqual (1, ace.AccessMask);
			Assert.AreEqual ("S-1-5-32-544", ace.SecurityIdentifier.Value);
			Assert.IsFalse (ace.IsInherited);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:DiscretionaryAclTest.cs

示例13: AddAccessFailsOnNonCanonical

		public void AddAccessFailsOnNonCanonical ()
		{
			SecurityIdentifier sid = new SecurityIdentifier ("BU");

			RawAcl acl = new RawAcl (RawAcl.AclRevision, 0);
			acl.InsertAce (0, new CommonAce (AceFlags.None, AceQualifier.AccessAllowed, 1, sid, false, null));
			acl.InsertAce (1, new CommonAce (AceFlags.None, AceQualifier.AccessDenied, 1, sid, false, null));

			DiscretionaryAcl dacl = new DiscretionaryAcl (false, false, acl);
			Assert.IsFalse (dacl.IsCanonical);
			Assert.AreEqual (2, dacl.Count);

			dacl.AddAccess (AccessControlType.Allow, sid, 1, InheritanceFlags.None, PropagationFlags.None);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:14,代码来源:DiscretionaryAclTest.cs

示例14: CommonSecurityDescriptor

		public CommonSecurityDescriptor (bool isContainer, bool isDS,
						 ControlFlags flags,
						 SecurityIdentifier owner,
						 SecurityIdentifier group,
						 SystemAcl systemAcl,
						 DiscretionaryAcl discretionaryAcl)
		{
			this.isContainer = isContainer;
			this.isDS = isDS;
			this.flags = flags;
			this.owner = owner;
			this.group = group;
			this.systemAcl = systemAcl;
			this.discretionaryAcl = discretionaryAcl;
			
			throw new NotImplementedException ();
		}
开发者ID:runefs,项目名称:Marvin,代码行数:17,代码来源:CommonSecurityDescriptor.cs

示例15: Init

		void Init (bool isContainer, bool isDS, RawSecurityDescriptor rawSecurityDescriptor)
		{
			if (null == rawSecurityDescriptor)
				throw new ArgumentNullException ("rawSecurityDescriptor");
				
			SystemAcl sacl = null;
			if (null != rawSecurityDescriptor.SystemAcl)
				sacl = new SystemAcl (isContainer, isDS, rawSecurityDescriptor.SystemAcl);
				
			DiscretionaryAcl dacl = null;
			if (null != rawSecurityDescriptor.DiscretionaryAcl)
				dacl = new DiscretionaryAcl (isContainer, isDS, rawSecurityDescriptor.DiscretionaryAcl);
				
			Init (isContainer, isDS,
			      rawSecurityDescriptor.ControlFlags,
			      rawSecurityDescriptor.Owner,
			      rawSecurityDescriptor.Group,
			      sacl, dacl);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:19,代码来源:CommonSecurityDescriptor.cs


注:本文中的System.Security.AccessControl.DiscretionaryAcl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。