do not check order sequence if option /order was not used
[mono.git] / mcs / class / corlib / System.Security / SecurityManager_mobile.cs
1 //
2 // System.Security.SecurityManager.cs
3 //
4 // Authors:
5 //      Nick Drochak(ndrochak@gol.com)
6 //      Sebastien Pouliot  <sebastien@ximian.com>
7 //
8 // (C) Nick Drochak
9 // Portions (C) 2004 Motus Technologies Inc. (http://www.motus.com)
10 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
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 #if MOBILE
33
34 using System.Collections;
35 using System.Diagnostics;
36 using System.Globalization;
37 using System.IO;
38 using System.Reflection;
39 using System.Runtime.CompilerServices;
40 using System.Runtime.InteropServices;
41 using System.Security.Permissions;
42 using System.Security.Policy;
43
44 namespace System.Security {
45
46         // Must match MonoDeclSecurityActions in /mono/metadata/reflection.h
47         internal struct RuntimeDeclSecurityActions {
48                 public RuntimeDeclSecurityEntry cas;
49                 public RuntimeDeclSecurityEntry noncas;
50                 public RuntimeDeclSecurityEntry choice;
51         }
52
53         [ComVisible (true)]
54         public static class SecurityManager {
55
56                 // properties
57
58 #if NET_4_0
59                 [Obsolete]
60 #endif
61                 public static bool CheckExecutionRights {
62                         get { return true; }
63                         set { ; }
64                 }
65
66                 [Obsolete ("The security manager cannot be turned off on MS runtime")]
67                 public static bool SecurityEnabled {
68                         get { return true; }
69                         set { ; }
70                 }
71                 
72                 internal static bool HasElevatedPermissions {
73                         get { return true; }
74                 }
75
76                 internal static bool CheckElevatedPermissions ()
77                 {
78                                 return true;
79                 }
80
81                 internal static void EnsureElevatedPermissions ()
82                 {
83                 }
84                 
85                 // methods
86
87                 [StrongNameIdentityPermission (SecurityAction.LinkDemand, PublicKey = "0x00000000000000000400000000000000")]
88                 public static void GetZoneAndOrigin (out ArrayList zone, out ArrayList origin) 
89                 {
90                         zone = new ArrayList ();
91                         origin = new ArrayList ();
92                 }
93
94 #if NET_4_0
95                 [Obsolete]
96 #endif
97                 public static bool IsGranted (IPermission perm)
98                 {
99                         return true;
100                 }
101
102 #if NET_4_0
103                 [Obsolete]
104 #endif
105                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
106                 public static PolicyLevel LoadPolicyLevelFromFile (string path, PolicyLevelType type)
107                 {
108                         throw new NotSupportedException ();
109                 }
110
111 #if NET_4_0
112                 [Obsolete]
113 #endif
114                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
115                 public static PolicyLevel LoadPolicyLevelFromString (string str, PolicyLevelType type)
116                 {
117                         throw new NotSupportedException ();
118                 }
119
120 #if NET_4_0
121                 [Obsolete]
122 #endif
123                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
124                 public static IEnumerator PolicyHierarchy ()
125                 {
126                         throw new NotSupportedException ();
127                 }
128
129 #if NET_4_0
130                 [Obsolete]
131 #endif
132                 public static PermissionSet ResolvePolicy (Evidence evidence)
133                 {
134                         throw new NotSupportedException ();
135                 }
136
137 #if NET_4_0
138                 [Obsolete]
139 #endif
140                 public static PermissionSet ResolvePolicy (Evidence[] evidences)
141                 {
142                         throw new NotSupportedException ();
143                 }
144
145 #if NET_4_0
146                 [Obsolete]
147 #endif
148                 public static PermissionSet ResolveSystemPolicy (Evidence evidence)
149                 {
150                         throw new NotSupportedException ();
151                 }
152
153 #if NET_4_0
154                 [Obsolete]
155 #endif
156                 public static PermissionSet ResolvePolicy (Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, out PermissionSet denied)
157                 {
158                         throw new NotSupportedException ();
159                 }
160
161 #if NET_4_0
162                 [Obsolete]
163 #endif
164                 public static IEnumerator ResolvePolicyGroups (Evidence evidence)
165                 {
166                         throw new NotSupportedException ();
167                 }
168
169 #if NET_4_0
170                 [Obsolete]
171 #endif
172                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
173                 public static void SavePolicy () 
174                 {
175                         throw new NotSupportedException ();
176                 }
177
178 #if NET_4_0
179                 [Obsolete]
180 #endif
181                 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
182                 public static void SavePolicyLevel (PolicyLevel level) 
183                 {
184                         throw new NotSupportedException ();
185                 }
186
187                 // private/internal stuff
188
189                 internal static bool ResolvePolicyLevel (ref PermissionSet ps, PolicyLevel pl, Evidence evidence)
190                 {
191                         throw new NotSupportedException ();
192                 }
193
194                 internal static void ResolveIdentityPermissions (PermissionSet ps, Evidence evidence)
195                 {
196                         throw new NotSupportedException ();
197                 }
198
199                 internal static PolicyLevel ResolvingPolicyLevel {
200                         get { return null; }
201                         set { ; }
202                 }
203
204                 internal static IPermission CheckPermissionSet (Assembly a, PermissionSet ps, bool noncas)
205                 {
206                         return null;
207                 }
208
209                 internal static IPermission CheckPermissionSet (AppDomain ad, PermissionSet ps)
210                 {
211                         return null;
212                 }
213
214                 internal static PermissionSet Decode (IntPtr permissions, int length)
215                 {
216                         throw new NotSupportedException ();
217                 }
218
219                 internal static PermissionSet Decode (byte[] encodedPermissions)
220                 {
221                         throw new NotSupportedException ();
222                 }
223
224                 internal static void ReflectedLinkDemandInvoke (MethodBase mb)
225                 {
226                         throw new NotSupportedException ();
227                 }
228
229                 internal static bool ReflectedLinkDemandQuery (MethodBase mb)
230                 {
231                         throw new NotSupportedException ();
232                 }
233
234 #if NET_4_0
235                 public static PermissionSet GetStandardSandbox (Evidence evidence)
236                 {
237                         if (evidence == null)
238                                 throw new ArgumentNullException ("evidence");
239
240                         throw new NotImplementedException ();
241                 }
242
243                 public static bool CurrentThreadRequiresSecurityContextCapture ()
244                 {
245                         throw new NotImplementedException ();
246                 }
247 #endif
248         }
249 }
250
251 #endif