ProfileDelete.php 934 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace dokuwiki\Action;
  3. use dokuwiki\Action\Exception\ActionAbort;
  4. use dokuwiki\Action\Exception\ActionDisabledException;
  5. use dokuwiki\Extension\AuthPlugin;
  6. /**
  7. * Class ProfileDelete
  8. *
  9. * Delete a user account
  10. *
  11. * @package dokuwiki\Action
  12. */
  13. class ProfileDelete extends AbstractUserAction {
  14. /** @inheritdoc */
  15. public function minimumPermission() {
  16. return AUTH_NONE;
  17. }
  18. /** @inheritdoc */
  19. public function checkPreconditions() {
  20. parent::checkPreconditions();
  21. /** @var AuthPlugin $auth */
  22. global $auth;
  23. if(!$auth->canDo('delUser')) throw new ActionDisabledException();
  24. }
  25. /** @inheritdoc */
  26. public function preProcess() {
  27. global $lang;
  28. if(auth_deleteprofile()) {
  29. msg($lang['profdeleted'], 1);
  30. throw new ActionAbort('show');
  31. } else {
  32. throw new ActionAbort('profile');
  33. }
  34. }
  35. }