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


C# Principal.IdentityReference类代码示例

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


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

示例1: AuthorizationRule

 protected internal AuthorizationRule(System.Security.Principal.IdentityReference identity, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags)
 {
     if (identity == null)
     {
         throw new ArgumentNullException("identity");
     }
     if (accessMask == 0)
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_ArgumentZero"), "accessMask");
     }
     if ((inheritanceFlags < System.Security.AccessControl.InheritanceFlags.None) || (inheritanceFlags > (System.Security.AccessControl.InheritanceFlags.ObjectInherit | System.Security.AccessControl.InheritanceFlags.ContainerInherit)))
     {
         throw new ArgumentOutOfRangeException("inheritanceFlags", Environment.GetResourceString("Argument_InvalidEnumValue", new object[] { inheritanceFlags, "InheritanceFlags" }));
     }
     if ((propagationFlags < System.Security.AccessControl.PropagationFlags.None) || (propagationFlags > (System.Security.AccessControl.PropagationFlags.InheritOnly | System.Security.AccessControl.PropagationFlags.NoPropagateInherit)))
     {
         throw new ArgumentOutOfRangeException("propagationFlags", Environment.GetResourceString("Argument_InvalidEnumValue", new object[] { inheritanceFlags, "PropagationFlags" }));
     }
     if (!identity.IsValidTargetType(typeof(SecurityIdentifier)))
     {
         throw new ArgumentException(Environment.GetResourceString("Arg_MustBeIdentityReferenceType"), "identity");
     }
     this._identity = identity;
     this._accessMask = accessMask;
     this._isInherited = isInherited;
     this._inheritanceFlags = inheritanceFlags;
     if (inheritanceFlags != System.Security.AccessControl.InheritanceFlags.None)
     {
         this._propagationFlags = propagationFlags;
     }
     else
     {
         this._propagationFlags = System.Security.AccessControl.PropagationFlags.None;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:AuthorizationRule.cs

示例2: AccessRuleFactory

		public override AccessRule AccessRuleFactory (IdentityReference identityReference,
							      int accessMask, bool isInherited,
							      InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags,
							      AccessControlType type)
		{
			return new PipeAccessRule (identityReference, (PipeAccessRights)accessMask, type);
		}
开发者ID:nicolas-raoul,项目名称:mono,代码行数:7,代码来源:PipeSecurity.cs

示例3: MutexAuditRule

		public MutexAuditRule (IdentityReference identity,
				       MutexRights eventRights,
				       AuditFlags flags)
			: base (identity, 0, false, InheritanceFlags.None, PropagationFlags.None, flags)
		{
			this.rights = eventRights;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:7,代码来源:MutexAuditRule.cs

示例4: AccessRuleFactory

		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);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:FileSystemSecurity.cs

示例5: AddAclRuleOnDirectory

 private static void AddAclRuleOnDirectory(string directory, IdentityReference identity, FileSystemRights rights, AccessControlType type)
 {
     var acl = Directory.GetAccessControl(directory);
     acl.PurgeAccessRules(identity);
     acl.AddAccessRule(new FileSystemAccessRule(identity, rights, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, type));
     Directory.SetAccessControl(directory, acl);
 }
开发者ID:vviskari,项目名称:MPExtended,代码行数:7,代码来源:EnvironmentChecks.cs

示例6: AddAclRuleOnFile

 private static void AddAclRuleOnFile(string file, IdentityReference identity, FileSystemRights rights, AccessControlType type)
 {
     var acl = File.GetAccessControl(file);
     acl.PurgeAccessRules(identity);
     acl.AddAccessRule(new FileSystemAccessRule(identity, rights, type));
     File.SetAccessControl(file, acl);
 }
开发者ID:vviskari,项目名称:MPExtended,代码行数:7,代码来源:EnvironmentChecks.cs

示例7: SemaphoreAccessRule

		public SemaphoreAccessRule (IdentityReference identity,
					    SemaphoreRights semaphoreRights,
					    AccessControlType type)
			: base (identity, 0, false, InheritanceFlags.None, PropagationFlags.None, type)
		{
			this.semaphoreRights = semaphoreRights;
		}
开发者ID:carrie901,项目名称:mono,代码行数:7,代码来源:SemaphoreAccessRule.cs

示例8: EventWaitHandleAuditRule

		public EventWaitHandleAuditRule (IdentityReference identity,
						 EventWaitHandleRights eventRights,
						 AuditFlags flags)
			: base (identity, 0, false, InheritanceFlags.None, PropagationFlags.None, flags)
		{
			if (eventRights < EventWaitHandleRights.Modify ||
			    eventRights > EventWaitHandleRights.FullControl) {
				throw new ArgumentOutOfRangeException ("eventRights");
			}
			if (flags < AuditFlags.None ||
			    flags > AuditFlags.Failure) {
				throw new ArgumentOutOfRangeException ("flags");
			}
			if (identity == null) {
				throw new ArgumentNullException ("identity");
			}
			if (eventRights == 0) {
				throw new ArgumentNullException ("eventRights");
			}
			if (flags == AuditFlags.None) {
				throw new ArgumentException ("flags");
			}
			if (!(identity is SecurityIdentifier)) {
				throw new ArgumentException ("identity");
			}
			
			this.rights = eventRights;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:28,代码来源:EventWaitHandleAuditRule.cs

示例9: AuditRuleFactory

		public virtual AuditRule AuditRuleFactory (IdentityReference identityReference, int accessMask,
							   bool isInherited, InheritanceFlags inheritanceFlags,
							   PropagationFlags propagationFlags, AuditFlags flags,
							   Guid objectType, Guid inheritedObjectType)
		{
			throw GetNotImplementedException ();
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:7,代码来源:DirectoryObjectSecurity.cs

示例10: AuditRuleFactory

		public override sealed AuditRule AuditRuleFactory (IdentityReference identityReference,
								   int accessMask, bool isInherited,
								   InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags,
								   AuditFlags flags)
		{
			return new PipeAuditRule (identityReference, (PipeAccessRights)accessMask, flags);
		}
开发者ID:nicolas-raoul,项目名称:mono,代码行数:7,代码来源:PipeSecurity.cs

示例11: AccessRule

		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;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:27,代码来源:AccessRule.cs

示例12: WaitableTimerAccessRule

 public WaitableTimerAccessRule(
     IdentityReference identity,
     WaitableTimerRights timerRights,
     AccessControlType type)
     : this(identity, (int)timerRights, false, InheritanceFlags.None, PropagationFlags.None, type)
 {
 }
开发者ID:alberthoekstra,项目名称:PVBeanCounter,代码行数:7,代码来源:WaitableTimerSecurity.cs

示例13: SemaphoreAuditRule

		public SemaphoreAuditRule (IdentityReference identity,
					   SemaphoreRights semaphoreRights,
					   AuditFlags flags)
			: base (identity, 0, false, InheritanceFlags.None, PropagationFlags.None, flags)
		{
			this.semaphoreRights = semaphoreRights;
		}
开发者ID:carrie901,项目名称:mono,代码行数:7,代码来源:SemaphoreAuditRule.cs

示例14: EventWaitHandleAccessRule

		public EventWaitHandleAccessRule (IdentityReference identity,
						  EventWaitHandleRights eventRights,
						  AccessControlType type)
			: base (identity, (int)eventRights, false,
				InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow)
		{
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:7,代码来源:EventWaitHandleAccessRule.cs

示例15: ShowDialog

        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public bool ShowDialog(ApplicationAccessRule accessRule)
        {
            AccessTypeCB.SelectedItem = accessRule.RuleType;
            IdentityNameTB.Text = accessRule.IdentityName;
            m_identity = accessRule.IdentityReference;

            if (m_identity == null)
            {
                AccountInfo account = AccountInfo.Create(IdentityNameTB.Text);

                if (account != null)
                {
                    m_identity = account.GetIdentityReference();
                }
            }

            if (accessRule.Right != ApplicationAccessRight.None)
            {
                AccessRightCB.SelectedItem = accessRule.Right;
            }

            if (ShowDialog() != DialogResult.OK)
            {
                return false;
            }
                    
            accessRule.RuleType = (AccessControlType)AccessTypeCB.SelectedItem;
            accessRule.Right = (ApplicationAccessRight)AccessRightCB.SelectedItem;
            accessRule.IdentityReference = m_identity;

            return true;
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:35,代码来源:AccessRuleDlg.cs


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