1f21dad39SAndreas Gohr<?php 2f21dad39SAndreas Gohr 3f21dad39SAndreas Gohrnamespace dokuwiki\Action; 4f21dad39SAndreas Gohr 56723156fSAndreas Gohruse dokuwiki\Ui\UserRegister; 6f21dad39SAndreas Gohruse dokuwiki\Action\Exception\ActionAbort; 7480336a3SAndreas Gohruse dokuwiki\Action\Exception\ActionDisabledException; 879a2d784SGerrit Uitslaguse dokuwiki\Extension\AuthPlugin; 92b5a1390SSatoshi Saharause dokuwiki\Ui; 10f21dad39SAndreas Gohr 11ab583a1bSAndreas Gohr/** 12ab583a1bSAndreas Gohr * Class Register 13ab583a1bSAndreas Gohr * 14ab583a1bSAndreas Gohr * Self registering a new user 15ab583a1bSAndreas Gohr * 16ab583a1bSAndreas Gohr * @package dokuwiki\Action 17ab583a1bSAndreas Gohr */ 182b5a1390SSatoshi Saharaclass Register extends AbstractAclAction 192b5a1390SSatoshi Sahara{ 20f21dad39SAndreas Gohr /** @inheritdoc */ 212b5a1390SSatoshi Sahara public function minimumPermission() 222b5a1390SSatoshi Sahara { 23f21dad39SAndreas Gohr return AUTH_NONE; 24f21dad39SAndreas Gohr } 25f21dad39SAndreas Gohr 26ab583a1bSAndreas Gohr /** @inheritdoc */ 272b5a1390SSatoshi Sahara public function checkPreconditions() 282b5a1390SSatoshi Sahara { 29b2c9cd19SAndreas Gohr parent::checkPreconditions(); 30480336a3SAndreas Gohr 3179a2d784SGerrit Uitslag /** @var AuthPlugin $auth */ 32480336a3SAndreas Gohr global $auth; 33480336a3SAndreas Gohr global $conf; 34480336a3SAndreas Gohr if (isset($conf['openregister']) && !$conf['openregister']) throw new ActionDisabledException(); 35480336a3SAndreas Gohr if (!$auth->canDo('addUser')) throw new ActionDisabledException(); 36480336a3SAndreas Gohr } 37480336a3SAndreas Gohr 38480336a3SAndreas Gohr /** @inheritdoc */ 392b5a1390SSatoshi Sahara public function preProcess() 402b5a1390SSatoshi Sahara { 41f21dad39SAndreas Gohr if (register()) { // FIXME could be moved from auth to here 42f21dad39SAndreas Gohr throw new ActionAbort('login'); 43f21dad39SAndreas Gohr } 44f21dad39SAndreas Gohr } 45f21dad39SAndreas Gohr 46ab583a1bSAndreas Gohr /** @inheritdoc */ 472b5a1390SSatoshi Sahara public function tplContent() 482b5a1390SSatoshi Sahara { 49*73022918SAndreas Gohr (new UserRegister())->show(); 50f21dad39SAndreas Gohr } 51f21dad39SAndreas Gohr} 52