DbDataPermission.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. //
  2. // System.Data.Common.DbDataPermission.cs
  3. //
  4. // Author:
  5. // Rodrigo Moya ([email protected])
  6. // Tim Coleman ([email protected])
  7. //
  8. // (C) Ximian, Inc
  9. // Copyright (C) Tim Coleman, 2002-2003
  10. //
  11. //
  12. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  13. //
  14. // Permission is hereby granted, free of charge, to any person obtaining
  15. // a copy of this software and associated documentation files (the
  16. // "Software"), to deal in the Software without restriction, including
  17. // without limitation the rights to use, copy, modify, merge, publish,
  18. // distribute, sublicense, and/or sell copies of the Software, and to
  19. // permit persons to whom the Software is furnished to do so, subject to
  20. // the following conditions:
  21. //
  22. // The above copyright notice and this permission notice shall be
  23. // included in all copies or substantial portions of the Software.
  24. //
  25. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  29. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  30. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  31. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. //
  33. using System.Data;
  34. using System.Security;
  35. using System.Security.Permissions;
  36. namespace System.Data.Common {
  37. [Serializable]
  38. public abstract class DBDataPermission : CodeAccessPermission, IUnrestrictedPermission
  39. {
  40. #region Fields
  41. bool allowBlankPassword;
  42. PermissionState state;
  43. #endregion // Fields
  44. #region Constructors
  45. #if NET_2_0
  46. [Obsolete ("use DBDataPermission (PermissionState.None)", true)]
  47. #endif
  48. protected DBDataPermission ()
  49. #if NET_2_0
  50. : this (PermissionState.None)
  51. #else
  52. : this (PermissionState.None, false)
  53. #endif
  54. {
  55. }
  56. [MonoTODO]
  57. protected DBDataPermission (DBDataPermission permission)
  58. {
  59. throw new NotImplementedException ();
  60. }
  61. [MonoTODO]
  62. protected DBDataPermission (DBDataPermissionAttribute permissionAttribute)
  63. {
  64. throw new NotImplementedException ();
  65. }
  66. #if NET_2_0
  67. [MonoTODO]
  68. protected DBDataPermission (DbConnectionString constr)
  69. {
  70. throw new NotImplementedException ();
  71. }
  72. #endif
  73. protected DBDataPermission (PermissionState state)
  74. : this (state, false, false)
  75. {
  76. }
  77. #if NET_2_0
  78. [Obsolete ("use DBDataPermission (PermissionState.None)", true)]
  79. #endif
  80. public DBDataPermission (PermissionState state, bool allowBlankPassword)
  81. : this (state, allowBlankPassword, true)
  82. {
  83. }
  84. internal DBDataPermission (PermissionState state, bool allowBlankPassword, bool dummyArg)
  85. {
  86. this.state = state;
  87. this.allowBlankPassword = allowBlankPassword;
  88. }
  89. #endregion // Constructors
  90. #region Properties
  91. public bool AllowBlankPassword {
  92. get { return allowBlankPassword; }
  93. set { allowBlankPassword = value; }
  94. }
  95. internal PermissionState State {
  96. get { return state; }
  97. set { state = value; }
  98. }
  99. #endregion // Properties
  100. #region Methods
  101. #if NET_1_1
  102. [MonoTODO]
  103. public virtual void Add (string connectionString, string restrictions, KeyRestrictionBehavior behavior)
  104. {
  105. throw new NotImplementedException ();
  106. }
  107. #endif
  108. #if NET_2_0
  109. [MonoTODO]
  110. protected void AddConnectionString (DbConnectionString constr)
  111. {
  112. throw new NotImplementedException ();
  113. }
  114. #endif
  115. [MonoTODO]
  116. protected void Clear ()
  117. {
  118. throw new NotImplementedException ();
  119. }
  120. public override IPermission Copy ()
  121. {
  122. DBDataPermission copy = CreateInstance ();
  123. copy.AllowBlankPassword = this.allowBlankPassword;
  124. copy.State = this.state;
  125. return copy;
  126. }
  127. protected virtual DBDataPermission CreateInstance ()
  128. {
  129. return (DBDataPermission) Activator.CreateInstance (this.GetType ());
  130. }
  131. [MonoTODO]
  132. public override void FromXml (SecurityElement securityElement)
  133. {
  134. throw new NotImplementedException ();
  135. }
  136. [MonoTODO]
  137. public override IPermission Intersect (IPermission target)
  138. {
  139. throw new NotImplementedException ();
  140. }
  141. [MonoTODO]
  142. public override bool IsSubsetOf (IPermission target)
  143. {
  144. throw new NotImplementedException ();
  145. }
  146. public bool IsUnrestricted ()
  147. {
  148. return (state == PermissionState.Unrestricted);
  149. }
  150. #if NET_2_0
  151. [MonoTODO]
  152. protected void SetConnectionString (DbConnectionString constr)
  153. {
  154. throw new NotImplementedException ();
  155. }
  156. [MonoTODO]
  157. public virtual void SetRestriction (string connectionString, string restrictions, KeyRestrictionBehavior behavior)
  158. {
  159. throw new NotImplementedException ();
  160. }
  161. #endif
  162. [MonoTODO]
  163. public override SecurityElement ToXml ()
  164. {
  165. throw new NotImplementedException ();
  166. }
  167. [MonoTODO]
  168. public override IPermission Union (IPermission target)
  169. {
  170. throw new NotImplementedException ();
  171. }
  172. #endregion // Methods
  173. }
  174. }