Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #403 from AKSW/fix/deactivateRegistration
Browse files Browse the repository at this point in the history
Repair deactivateRegistration .ini entry in Erfurt. Fix #390.
  • Loading branch information
white-gecko authored May 3, 2017
2 parents 7b0f820 + 4b3d1b8 commit 04f8c61
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
3 changes: 2 additions & 1 deletion application/classes/OntoWiki/Menu/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ private function _getApplicationMenu($context = null)

// user sub menu
if ($owApp->erfurt->isActionAllowed('RegisterNewUser')
&& !(isset($owApp->config->ac) && ((boolean)$owApp->config->ac->deactivateRegistration === true))
&& !(isset($owApp->config->ac)
&& ((boolean)$owApp->config->ac->deactivateRegistration === true))
) {

if (!($owApp->erfurt->getAc() instanceof Erfurt_Ac_None)) {
Expand Down
4 changes: 4 additions & 0 deletions application/config/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ descriptionHelper.properties.dcDesc2 = "http://purl.org/dc/elements/1.1/descript
descriptionHelper.properties.skosNote = "http://www.w3.org/2004/02/skos/core#note"
descriptionHelper.properties.skosEditorialNote = "http://www.w3.org/2004/02/skos/core#editorialNote"

;;
; AC settings
;;
;ac.deactivateRegistration = true

;;
; List settings
Expand Down
32 changes: 30 additions & 2 deletions application/controllers/ApplicationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ public function logoutAction()
public function registerAction()
{
OntoWiki::getInstance()->getNavigation()->disableNavigation();
//check if the Register Action is allowed
if (isset($this->_owApp->config->ac)
&& ((boolean)$this->_owApp->config->ac->deactivateRegistration === true)
) {
$this->_helper->viewRenderer->setNoRender();
$this->view->placeholder('main.window.title')->set('Register User');
$message = 'The registration is deactivated, please consult an Admin about this.';
$this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR));
return;
}
$this->_helper->viewRenderer->setScriptAction('register');

$this->view->placeholder('main.window.title')->set('Register User');
Expand Down Expand Up @@ -358,7 +368,16 @@ public function registerAction()
public function openidregAction()
{
OntoWiki::getInstance()->getNavigation()->disableNavigation();

//check if the Register Action is allowed
if (isset($this->_owApp->config->ac)
&& ((boolean)$this->_owApp->config->ac->deactivateRegistration === true)
) {
$this->_helper->viewRenderer->setNoRender();
$this->view->placeholder('main.window.title')->set('Register User');
$message = 'The registration is deactivated, please consult an Admin about this.';
$this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR));
return;
}
// We render a template, that is also used for preferences.
$this->_helper->viewRenderer->setScriptAction('openid');

Expand Down Expand Up @@ -549,7 +568,16 @@ public function openidregAction()
public function webidregAction()
{
OntoWiki::getInstance()->getNavigation()->disableNavigation();

//check if the Register Action is allowed
if (isset($this->_owApp->config->ac)
&& ((boolean)$this->_owApp->config->ac->deactivateRegistration === true)
) {
$this->_helper->viewRenderer->setNoRender();
$this->view->placeholder('main.window.title')->set('Register User');
$message = 'The registration is deactivated, please consult an Admin about this.';
$this->_owApp->appendMessage(new OntoWiki_Message($message, OntoWiki_Message::ERROR));
return;
}
// We render a template, that is also used for preferences.
$this->_helper->viewRenderer->setScriptAction('webid');

Expand Down
5 changes: 4 additions & 1 deletion extensions/account/LoginModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ public function getContents()
'redirectUri' => urlencode((string)$url)
);

if ($this->_erfurt->getAc()->isActionAllowed('RegisterNewUser')) {
if ($this->_erfurt->getAc()->isActionAllowed('RegisterNewUser')
&& !(isset($this->_owApp->config->ac)
&& ((boolean)$this->_owApp->config->ac->deactivateRegistration === true))
) {
$data['showRegisterButton'] = true;
$data['registerActionUrl'] = $this->_config->urlBase . 'application/register';
$data['openIdRegisterActionUrl'] = $this->_config->urlBase . 'application/openidreg';
Expand Down

0 comments on commit 04f8c61

Please sign in to comment.