--- /dev/null
+// System.Security.AccessControl.AccessRule<T>
+//
+// Copyright 2012 James F. Bellinger
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#if NET_4_0
+
+using System;
+using System.Security.Principal;
+
+namespace System.Security.AccessControl
+{
+ public class AccessRule<T> : AccessRule where T : struct
+ {
+ public AccessRule (string identity, T rights, AccessControlType type)
+ : this (new NTAccount (identity), rights, type)
+ {
+
+ }
+
+ public AccessRule (IdentityReference identity, T rights, AccessControlType type)
+ : this (identity, rights, InheritanceFlags.None, PropagationFlags.None, type)
+ {
+
+ }
+
+ public AccessRule (string identity, T rights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
+ : this (new NTAccount (identity), rights, inheritanceFlags, propagationFlags, type)
+ {
+
+ }
+
+ public AccessRule (IdentityReference identity, T rights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
+ : this (identity, (int)(object)rights, false, inheritanceFlags, propagationFlags, type)
+ {
+
+ }
+
+ internal AccessRule (IdentityReference identity, int rights, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
+ : base (identity, rights, isInherited, inheritanceFlags, propagationFlags, type)
+ {
+
+ }
+
+ public T Rights {
+ get { return (T)(object)AccessMask; }
+ }
+ }
+}
+
+#endif
+
--- /dev/null
+// System.Security.AccessControl.AuditRule<T>
+//
+// Copyright 2012 James F. Bellinger
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#if NET_4_0
+
+using System;
+using System.Security.Principal;
+
+namespace System.Security.AccessControl
+{
+ public class AuditRule<T> : AuditRule where T : struct
+ {
+ public AuditRule (string identity, T rights, AuditFlags flags)
+ : this (new NTAccount (identity), rights, flags)
+ {
+
+ }
+
+ public AuditRule (IdentityReference identity, T rights, AuditFlags flags)
+ : this (identity, rights, InheritanceFlags.None, PropagationFlags.None, flags)
+ {
+
+ }
+
+ public AuditRule (string identity, T rights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
+ : this (new NTAccount (identity), rights, inheritanceFlags, propagationFlags, flags)
+ {
+
+ }
+
+ public AuditRule (IdentityReference identity, T rights, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
+ : this (identity, (int)(object)rights, false, inheritanceFlags, propagationFlags, flags)
+ {
+
+ }
+
+ internal AuditRule (IdentityReference identity, int rights, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
+ : base (identity, rights, isInherited, inheritanceFlags, propagationFlags, flags)
+ {
+
+ }
+
+ public T Rights {
+ get { return (T)(object)AccessMask; }
+ }
+ }
+}
+
+#endif
+
+2012-06-30 James Bellinger <jfb@zer7.com>
+
+ * AccessRule_T.cs AuditRule_T.cs: Implemented .NET 4.0 generic
+ versions of AccessRule and AuditRule.
+ * ObjectSecurity_T.cs: Type returns are now correct.
+
2009-08-29 Zoltan Varga <vargaz@gmail.com>
* ObjectSecurity_T.cs: New file, empty stub for new net 4.0 class.
{
public override Type AccessRightType {
get {
- return null;
+ return typeof(T);
}
}
public override Type AccessRuleType {
get {
- return null;
+ return typeof (AccessRule<T>);
}
}
public override Type AuditRuleType {
get {
- return null;
+ return typeof (AuditRule<T>);
}
}
public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
{
- return null;
+ return new AccessRule<T> (identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, type);
}
public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
{
- return null;
+ return new AuditRule<T> (identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, flags);
}
}
}
-#endif
\ No newline at end of file
+#endif
System.Security.AccessControl/AccessControlSections.cs
System.Security.AccessControl/AccessControlType.cs
System.Security.AccessControl/AccessRule.cs
+System.Security.AccessControl/AccessRule_T.cs
System.Security.AccessControl/AceEnumerator.cs
System.Security.AccessControl/AceFlags.cs
System.Security.AccessControl/AceQualifier.cs
System.Security.AccessControl/AceType.cs
System.Security.AccessControl/AuditFlags.cs
System.Security.AccessControl/AuditRule.cs
+System.Security.AccessControl/AuditRule_T.cs
System.Security.AccessControl/AuthorizationRule.cs
System.Security.AccessControl/AuthorizationRuleCollection.cs
System.Security.AccessControl/CommonAce.cs