Merge pull request #439 from mono-soc-2012/garyb/iconfix
[mono.git] / mcs / class / corlib / System.Security.AccessControl / RegistrySecurity.cs
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
11 //
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.
30 //
31
32 using System.Security.Principal;
33
34 namespace System.Security.AccessControl
35 {
36         public sealed class RegistrySecurity : NativeObjectSecurity
37         {
38                 public RegistrySecurity ()
39                         : base (true, ResourceType.RegistryKey)
40                 {
41                 }
42                 
43                 internal RegistrySecurity (string name, AccessControlSections includeSections)
44                         : base (true, ResourceType.RegistryKey, name, includeSections)
45                 {
46                 }
47                 
48                 public override Type AccessRightType {
49                         get { return typeof (RegistryRights); }
50                 }
51                 
52                 public override Type AccessRuleType {
53                         get { return typeof (RegistryAccessRule); }
54                 }
55
56                 public override Type AuditRuleType {
57                         get { return typeof (RegistryAuditRule); }
58                 }
59                 
60                 public override AccessRule AccessRuleFactory (IdentityReference identityReference, int accessMask,
61                                                               bool isInherited, InheritanceFlags inheritanceFlags,
62                                                               PropagationFlags propagationFlags, AccessControlType type)
63                 {
64                         return new RegistryAccessRule (identityReference, (RegistryRights) accessMask, isInherited,
65                                                        inheritanceFlags, propagationFlags, type);
66                 }
67                 
68                 public void AddAccessRule (RegistryAccessRule rule)
69                 {
70                         AddAccessRule ((AccessRule)rule);
71                 }
72                 
73                 public bool RemoveAccessRule (RegistryAccessRule rule)
74                 {
75                         return RemoveAccessRule ((AccessRule)rule);
76                 }
77                 
78                 public void RemoveAccessRuleAll (RegistryAccessRule rule)
79                 {
80                         RemoveAccessRuleAll ((AccessRule)rule);
81                 }
82                 
83                 public void RemoveAccessRuleSpecific (RegistryAccessRule rule)
84                 {
85                         RemoveAccessRuleSpecific ((AccessRule)rule);
86                 }
87                 
88                 public void ResetAccessRule (RegistryAccessRule rule)
89                 {
90                         ResetAccessRule ((AccessRule)rule);
91                 }
92                 
93                 public void SetAccessRule (RegistryAccessRule rule)
94                 {
95                         SetAccessRule ((AccessRule)rule);
96                 }
97                 
98                 public override AuditRule AuditRuleFactory (IdentityReference identityReference, int accessMask,
99                                                             bool isInherited, InheritanceFlags inheritanceFlags,
100                                                             PropagationFlags propagationFlags, AuditFlags flags)
101                 {
102                         return new RegistryAuditRule (identityReference, (RegistryRights) accessMask, isInherited,
103                                                       inheritanceFlags, propagationFlags, flags);
104                 }
105                 
106                 public void AddAuditRule (RegistryAuditRule rule)
107                 {
108                         AddAuditRule ((AuditRule)rule);
109                 }
110                 
111                 public bool RemoveAuditRule (RegistryAuditRule rule)
112                 {
113                         return RemoveAuditRule((AuditRule)rule);
114                 }
115                 
116                 public void RemoveAuditRuleAll (RegistryAuditRule rule)
117                 {
118                         RemoveAuditRuleAll((AuditRule)rule);
119                 }
120                 
121                 public void RemoveAuditRuleSpecific (RegistryAuditRule rule)
122                 {
123                         RemoveAuditRuleSpecific((AuditRule)rule);
124                 }
125                 
126                 public void SetAuditRule (RegistryAuditRule rule)
127                 {
128                         SetAuditRule((AuditRule)rule);
129                 }
130         }
131 }
132