UserConfigManagerInterface.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /**
  3. * MageSpecialist
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to info@magespecialist.it so we can send you a copy immediately.
  14. *
  15. * @category MSP
  16. * @package MSP_TwoFactorAuth
  17. * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it)
  18. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  19. */
  20. namespace MSP\TwoFactorAuth\Api;
  21. interface UserConfigManagerInterface
  22. {
  23. const ACTIVE_CONFIG_KEY = 'active';
  24. /**
  25. * Get a provider configuration for a given user
  26. * @param int $userId
  27. * @param int $providerCode
  28. * @return array
  29. * @throws \Magento\Framework\Exception\NoSuchEntityException
  30. */
  31. public function getProviderConfig($userId, $providerCode);
  32. /**
  33. * Set provider configuration
  34. * @param int $userId
  35. * @param string $providerCode
  36. * @param array|null $config
  37. * @return boolean
  38. * @throws \Magento\Framework\Exception\NoSuchEntityException
  39. */
  40. public function setProviderConfig($userId, $providerCode, $config);
  41. /**
  42. * Set provider configuration
  43. * @param int $userId
  44. * @param string $providerCode
  45. * @param array|null $config
  46. * @return boolean
  47. * @throws \Magento\Framework\Exception\NoSuchEntityException
  48. */
  49. public function addProviderConfig($userId, $providerCode, $config);
  50. /**
  51. * Reset provider configuration
  52. * @param int $userId
  53. * @param string $providerCode
  54. * @return boolean
  55. * @throws \Magento\Framework\Exception\NoSuchEntityException
  56. */
  57. public function resetProviderConfig($userId, $providerCode);
  58. /**
  59. * Set providers list for a given user
  60. * @param int $userId
  61. * @param string $providersCodes
  62. * @return boolean
  63. * @throws \Magento\Framework\Exception\NoSuchEntityException
  64. */
  65. public function setProvidersCodes($userId, $providersCodes);
  66. /**
  67. * Set providers list for a given user
  68. * @param int $userId
  69. * @return string[]
  70. */
  71. public function getProvidersCodes($userId);
  72. /**
  73. * Activate a provider configuration
  74. * @param int $userId
  75. * @param string $providerCode
  76. * @return boolean
  77. * @throws \Magento\Framework\Exception\NoSuchEntityException
  78. */
  79. public function activateProviderConfiguration($userId, $providerCode);
  80. /**
  81. * Return true if a provider configuration has been activated
  82. * @param int $userId
  83. * @param string $providerCode
  84. * @return boolean
  85. * @throws \Magento\Framework\Exception\NoSuchEntityException
  86. */
  87. public function isProviderConfigurationActive($userId, $providerCode);
  88. /**
  89. * Set default provider
  90. * @param int $userId
  91. * @param string $providerCode
  92. * @return boolean
  93. * @throws \Magento\Framework\Exception\NoSuchEntityException
  94. */
  95. public function setDefaultProvider($userId, $providerCode);
  96. /**
  97. * get default provider
  98. * @param int $userId
  99. * @return string
  100. */
  101. public function getDefaultProvider($userId);
  102. }