1f21dad39SAndreas Gohr<?php 2f21dad39SAndreas Gohr 3f21dad39SAndreas Gohrnamespace dokuwiki\Action; 4f21dad39SAndreas Gohr 5f21dad39SAndreas Gohruse dokuwiki\Action\Exception\ActionAbort; 6*480336a3SAndreas Gohruse dokuwiki\Action\Exception\ActionDisabledException; 7f21dad39SAndreas Gohr 8ab583a1bSAndreas Gohr/** 9ab583a1bSAndreas Gohr * Class Register 10ab583a1bSAndreas Gohr * 11ab583a1bSAndreas Gohr * Self registering a new user 12ab583a1bSAndreas Gohr * 13ab583a1bSAndreas Gohr * @package dokuwiki\Action 14ab583a1bSAndreas Gohr */ 15*480336a3SAndreas Gohrclass Register extends AbstractAclAction { 16f21dad39SAndreas Gohr 17f21dad39SAndreas Gohr /** @inheritdoc */ 18ec701221SAndreas Gohr public function minimumPermission() { 19f21dad39SAndreas Gohr return AUTH_NONE; 20f21dad39SAndreas Gohr } 21f21dad39SAndreas Gohr 22ab583a1bSAndreas Gohr /** @inheritdoc */ 23*480336a3SAndreas Gohr public function checkPermissions() { 24*480336a3SAndreas Gohr parent::checkPermissions(); 25*480336a3SAndreas Gohr 26*480336a3SAndreas Gohr /** @var \DokuWiki_Auth_Plugin $auth */ 27*480336a3SAndreas Gohr global $auth; 28*480336a3SAndreas Gohr global $conf; 29*480336a3SAndreas Gohr if(isset($conf['openregister']) && !$conf['openregister']) throw new ActionDisabledException(); 30*480336a3SAndreas Gohr if(!$auth->canDo('addUser')) throw new ActionDisabledException(); 31*480336a3SAndreas Gohr } 32*480336a3SAndreas Gohr 33*480336a3SAndreas Gohr /** @inheritdoc */ 34f21dad39SAndreas Gohr public function preProcess() { 35f21dad39SAndreas Gohr if(register()) { // FIXME could be moved from auth to here 36f21dad39SAndreas Gohr throw new ActionAbort('login'); 37f21dad39SAndreas Gohr } 38f21dad39SAndreas Gohr } 39f21dad39SAndreas Gohr 40ab583a1bSAndreas Gohr /** @inheritdoc */ 41f21dad39SAndreas Gohr public function tplContent() { 42f21dad39SAndreas Gohr html_register(); 43f21dad39SAndreas Gohr } 44f21dad39SAndreas Gohr 45f21dad39SAndreas Gohr} 46