本文整理汇总了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;
}
}
示例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);
}
示例3: MutexAuditRule
public MutexAuditRule (IdentityReference identity,
MutexRights eventRights,
AuditFlags flags)
: base (identity, 0, false, InheritanceFlags.None, PropagationFlags.None, flags)
{
this.rights = eventRights;
}
示例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);
}
示例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);
}
示例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);
}
示例7: SemaphoreAccessRule
public SemaphoreAccessRule (IdentityReference identity,
SemaphoreRights semaphoreRights,
AccessControlType type)
: base (identity, 0, false, InheritanceFlags.None, PropagationFlags.None, type)
{
this.semaphoreRights = semaphoreRights;
}
示例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;
}
示例9: AuditRuleFactory
public virtual AuditRule AuditRuleFactory (IdentityReference identityReference, int accessMask,
bool isInherited, InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags, AuditFlags flags,
Guid objectType, Guid inheritedObjectType)
{
throw GetNotImplementedException ();
}
示例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);
}
示例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;
}
示例12: WaitableTimerAccessRule
public WaitableTimerAccessRule(
IdentityReference identity,
WaitableTimerRights timerRights,
AccessControlType type)
: this(identity, (int)timerRights, false, InheritanceFlags.None, PropagationFlags.None, type)
{
}
示例13: SemaphoreAuditRule
public SemaphoreAuditRule (IdentityReference identity,
SemaphoreRights semaphoreRights,
AuditFlags flags)
: base (identity, 0, false, InheritanceFlags.None, PropagationFlags.None, flags)
{
this.semaphoreRights = semaphoreRights;
}
示例14: EventWaitHandleAccessRule
public EventWaitHandleAccessRule (IdentityReference identity,
EventWaitHandleRights eventRights,
AccessControlType type)
: base (identity, (int)eventRights, false,
InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow)
{
}
示例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;
}