BxAccntModule.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup Accounts Accounts
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxAccntModule extends BxBaseModGeneralModule
  12. {
  13. /**
  14. * Constructor
  15. */
  16. function __construct($aModule)
  17. {
  18. parent::__construct($aModule);
  19. $this->_oConfig->init($this->_oDb);
  20. }
  21. public function serviceGetMenuAddonManageTools()
  22. {
  23. bx_import('SearchResult', $this->_aModule);
  24. $sClass = $this->_aModule['class_prefix'] . 'SearchResult';
  25. $o = new $sClass();
  26. $o->fillFilters(array(
  27. 'unconfirmed' => 1
  28. ));
  29. $o->unsetPaginate();
  30. return $o->getNum();
  31. }
  32. public function checkAllowedDelete(&$aDataEntry, $isPerformAction = false)
  33. {
  34. if(isAdmin() && (int)$aDataEntry['id'] == getLoggedId())
  35. return _t('_sys_txt_access_denied');
  36. // check ACL
  37. $aCheck = checkActionModule($this->_iProfileId, 'delete account', 'system', $isPerformAction);
  38. if($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED)
  39. return $aCheck[CHECK_ACTION_MESSAGE];
  40. return CHECK_ACTION_RESULT_ALLOWED;
  41. }
  42. public function checkAllowedMakeOperator(&$aDataEntry, $isPerformAction = false)
  43. {
  44. $bAdmin = isAdmin();
  45. if(!$bAdmin || (int)$aDataEntry['id'] == getLoggedId() || (int)$aDataEntry['role'] == 3)
  46. return _t('_sys_txt_access_denied');
  47. return CHECK_ACTION_RESULT_ALLOWED;
  48. }
  49. public function checkAllowedUnmakeOperator(&$aDataEntry, $isPerformAction = false)
  50. {
  51. $bAdmin = isAdmin();
  52. if(!$bAdmin || (int)$aDataEntry['id'] == getLoggedId() || (int)$aDataEntry['role'] != 3)
  53. return _t('_sys_txt_access_denied');
  54. return CHECK_ACTION_RESULT_ALLOWED;
  55. }
  56. }
  57. /** @} */