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.

100 lines
3.3 KiB

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