本文整理汇总了C#中AccessControlType类的典型用法代码示例。如果您正苦于以下问题:C# AccessControlType类的具体用法?C# AccessControlType怎么用?C# AccessControlType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessControlType类属于命名空间,在下文中一共展示了AccessControlType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: AddAccess
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);
}
示例4: SemaphoreAccessRule
public SemaphoreAccessRule (string identity,
SemaphoreRights semaphoreRights,
AccessControlType type)
: base (null, 0, false, InheritanceFlags.None, PropagationFlags.None, type)
{
this.semaphoreRights = semaphoreRights;
}
示例5: AddFileSecurity
public static void AddFileSecurity(string fileName, string WindowsAccount, FileSystemRights rights, AccessControlType accessControlType)
{
FileSecurity fSecurity = File.GetAccessControl(fileName);
fSecurity.AddAccessRule(new FileSystemAccessRule(WindowsAccount, rights, accessControlType));
File.SetAccessControl(fileName, fSecurity);
}
示例6: AccessRuleFactory
public virtual AccessRule AccessRuleFactory (IdentityReference identityReference, int accessMask,
bool isInherited, InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags, AccessControlType type,
Guid objectType, Guid inheritedObjectType)
{
throw GetNotImplementedException ();
}
示例7: base
public FileSystemAccessRule
(String identity, FileSystemRights fileSystemRights,
InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags, AccessControlType type)
: base(IdentityReference.IdentityFromName(identity),
(int)fileSystemRights, false, inheritanceFlags,
propagationFlags, type) {}
示例8: 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);
}
示例9: 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;
}
示例10: WaitableTimerAccessRule
public WaitableTimerAccessRule(
IdentityReference identity,
WaitableTimerRights timerRights,
AccessControlType type)
: this(identity, (int)timerRights, false, InheritanceFlags.None, PropagationFlags.None, type)
{
}
示例11: TestAddAccess
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;
}
示例12: EventWaitHandleAccessRule
public EventWaitHandleAccessRule (IdentityReference identity,
EventWaitHandleRights eventRights,
AccessControlType type)
: base (identity, (int)eventRights, false,
InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow)
{
}
示例13: base
public RegistryAccessRule
(String identity, RegistryRights registryRights,
InheritanceFlags inheritanceFlags,
PropagationFlags propagationFlags, AccessControlType type)
: base(IdentityReference.IdentityFromName(identity),
(int)registryRights, false, inheritanceFlags,
propagationFlags, type) {}
示例14: MutexAccessRule
public MutexAccessRule (IdentityReference identity,
MutexRights eventRights,
AccessControlType type)
: base (identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
{
}
示例15: AddDirectorySecurity
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);
}