You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.9 KiB

4 years ago
  1. // Copyright © 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  2. //
  3. // MySQL Connector/NET is licensed under the terms of the GPLv2
  4. // <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
  5. // MySQL Connectors. There are special exceptions to the terms and
  6. // conditions of the GPLv2 as it is applied to this software, see the
  7. // FLOSS License Exception
  8. // <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
  9. //
  10. // This program is free software; you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published
  12. // by the Free Software Foundation; version 2 of the License.
  13. //
  14. // This program is distributed in the hope that it will be useful, but
  15. // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  16. // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  17. // for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License along
  20. // with this program; if not, write to the Free Software Foundation, Inc.,
  21. // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  22. #if MYSQL_6_9
  23. using System;
  24. using System.Collections.Generic;
  25. using System.Data;
  26. using System.Data.Common;
  27. using System.Security;
  28. using System.Security.Permissions;
  29. namespace Externals.MySql.Data.MySqlClient
  30. {
  31. [Serializable]
  32. internal sealed class MySqlClientPermission : DBDataPermission
  33. {
  34. #region Contructors
  35. public MySqlClientPermission(PermissionState permissionState)
  36. : base(permissionState)
  37. {
  38. }
  39. private MySqlClientPermission(MySqlClientPermission permission):base(permission)
  40. {
  41. }
  42. internal MySqlClientPermission(MySqlClientPermissionAttribute permissionAttribute):base(permissionAttribute)
  43. {
  44. }
  45. internal MySqlClientPermission (DBDataPermission permission)
  46. : base (permission)
  47. {
  48. }
  49. internal MySqlClientPermission(string connectionString)
  50. : base(PermissionState.None)
  51. {
  52. if ((connectionString == null) || connectionString.Length == 0)
  53. base.Add(string.Empty, string.Empty, KeyRestrictionBehavior.AllowOnly);
  54. else
  55. base.Add(connectionString, string.Empty, KeyRestrictionBehavior.AllowOnly);
  56. }
  57. #endregion
  58. #region Methods
  59. /// <summary>
  60. /// Adds a new connection string with set of restricted keywords to the MySqlClientPermission object
  61. /// </summary>
  62. ///<param name="connectionString">Settings to be used for the connection</param>
  63. ///<param name="restrictions">Keywords to define the restrictions</param>
  64. ///<param name="behavior">KeyRestrictionBehavior to be used</param>
  65. public override void Add(string connectionString, string restrictions, KeyRestrictionBehavior behavior)
  66. {
  67. base.Add(connectionString, restrictions, behavior);
  68. }
  69. /// <summary>
  70. /// Returns MySqlClientPermission as an IPermission
  71. /// </summary>
  72. /// <returns></returns>
  73. public override IPermission Copy()
  74. {
  75. return new MySqlClientPermission(this);
  76. }
  77. #endregion
  78. }
  79. }
  80. #endif