Commit dd66e9e2 authored by Andreas Beutel's avatar Andreas Beutel 🦊
Browse files

Merge branch '9-configuration-editor-validation' into 'master'

Resolve "Configuration Editor Validation"

Closes #9

See merge request t3o/election!4
parents f2bf761d 8ab374ac
......@@ -43,8 +43,27 @@ class BeDashboardController extends AbstractBeController
'elections' => $this->electionRepository->findAll(),
]
);
if ($this->configuration) {
$electionManagerGroup = $this->configuration->getElectionManagerGroup();
if ($this->configuration->isGroupConfigComplete()) {
$electionManagerGroup = $this->configuration->getElectionManagerGroup();
}
else {
$this->addFlashMessage(
LocalizationUtility::translate('view.be.dashboard.index.no_proper_configuration_msg_body', $this->extensionName),
LocalizationUtility::translate('view.be.dashboard.index.no_configuration_msg_title', $this->extensionName),
AbstractMessage::ERROR
);
if ($GLOBALS['BE_USER']->isAdmin()) {
$this->redirect('edit','BeConfiguration');
} else {
$this->addFlashMessage(
LocalizationUtility::translate('view.be.dashboard.index.no_proper_configuration_msg_body_admin', $this->extensionName),
LocalizationUtility::translate('view.be.dashboard.index.no_configuration_msg_title', $this->extensionName),
AbstractMessage::ERROR
);
}
}
}
else {
$this->addFlashMessage(
......
......@@ -213,6 +213,13 @@ class Configuration extends AbstractEntity
$this->testEmail = $testEmail;
}
public function isGroupConfigComplete() {
if ($this->getAdministrationGroup() && $this->getElectionManagerGroup() && $this->getPollManagerGroup()) {
return true;
}
return false;
}
/**
* @return Configuration
*/
......
......@@ -104,6 +104,12 @@
<trans-unit id="view.be.dashboard.index.no_configuration_msg_body">
<source>Please add a configuration record.</source>
</trans-unit>
<trans-unit id="view.be.dashboard.index.no_proper_configuration_msg_body">
<source>Your configuration is incomplete. Please add all needed Backend User Groups.</source>
</trans-unit>
<trans-unit id="view.be.dashboard.index.no_proper_configuration_msg_body_admin">
<source>An Admin Login is needed, to create a proper election configuration.</source>
</trans-unit>
<trans-unit id="view.be.dashboard.index.no_electionmanagergroup_msg_title">
<source>No election manager group is set</source>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment