Fix watchos tests for system.data (#6600)
[mono-project.git] / mcs / class / corlib / System.Security.AccessControl / RegistrySecurity.cs
blob24afb43263bdb38048a5fed3e7de6b94c82028bd
1 //
2 // System.Security.AccessControl.RegistrySecurity implementation
3 //
4 // Authors:
5 // Dick Porter <dick@ximian.com>
6 // Atsushi Enomoto <atsushi@ximian.com>
7 // James Bellinger <jfb@zer7.com>
8 //
9 // Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
10 // Copyright (C) 2012 James Bellinger
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Security.Principal;
34 namespace System.Security.AccessControl
36 public sealed class RegistrySecurity : NativeObjectSecurity
38 public RegistrySecurity ()
39 : base (true, ResourceType.RegistryKey)
43 internal RegistrySecurity (string name, AccessControlSections includeSections)
44 : base (true, ResourceType.RegistryKey, name, includeSections)
48 public override Type AccessRightType {
49 get { return typeof (RegistryRights); }
52 public override Type AccessRuleType {
53 get { return typeof (RegistryAccessRule); }
56 public override Type AuditRuleType {
57 get { return typeof (RegistryAuditRule); }
60 public override AccessRule AccessRuleFactory (IdentityReference identityReference, int accessMask,
61 bool isInherited, InheritanceFlags inheritanceFlags,
62 PropagationFlags propagationFlags, AccessControlType type)
64 return new RegistryAccessRule (identityReference, (RegistryRights) accessMask, isInherited,
65 inheritanceFlags, propagationFlags, type);
68 public void AddAccessRule (RegistryAccessRule rule)
70 AddAccessRule ((AccessRule)rule);
73 public bool RemoveAccessRule (RegistryAccessRule rule)
75 return RemoveAccessRule ((AccessRule)rule);
78 public void RemoveAccessRuleAll (RegistryAccessRule rule)
80 RemoveAccessRuleAll ((AccessRule)rule);
83 public void RemoveAccessRuleSpecific (RegistryAccessRule rule)
85 RemoveAccessRuleSpecific ((AccessRule)rule);
88 public void ResetAccessRule (RegistryAccessRule rule)
90 ResetAccessRule ((AccessRule)rule);
93 public void SetAccessRule (RegistryAccessRule rule)
95 SetAccessRule ((AccessRule)rule);
98 public override AuditRule AuditRuleFactory (IdentityReference identityReference, int accessMask,
99 bool isInherited, InheritanceFlags inheritanceFlags,
100 PropagationFlags propagationFlags, AuditFlags flags)
102 return new RegistryAuditRule (identityReference, (RegistryRights) accessMask, isInherited,
103 inheritanceFlags, propagationFlags, flags);
106 public void AddAuditRule (RegistryAuditRule rule)
108 AddAuditRule ((AuditRule)rule);
111 public bool RemoveAuditRule (RegistryAuditRule rule)
113 return RemoveAuditRule((AuditRule)rule);
116 public void RemoveAuditRuleAll (RegistryAuditRule rule)
118 RemoveAuditRuleAll((AuditRule)rule);
121 public void RemoveAuditRuleSpecific (RegistryAuditRule rule)
123 RemoveAuditRuleSpecific((AuditRule)rule);
126 public void SetAuditRule (RegistryAuditRule rule)
128 SetAuditRule((AuditRule)rule);