Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
voting.typo3.org
extensions
election
Commits
f8b8d14d
Commit
f8b8d14d
authored
Mar 17, 2019
by
Stefan Busemann
Browse files
[BUGFIX] Add fallback configuration
Allow an admin user, to edit the election config, if the config is misconfigured.
parent
f2bf761d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/BeDashboardController.php
View file @
f8b8d14d
...
...
@@ -43,8 +43,27 @@ class BeDashboardController extends AbstractBeController
'elections'
=>
$this
->
electionRepository
->
findAll
(),
]
);
if
(
$this
->
configuration
)
{
$electionManagerGroup
=
$this
->
configuration
->
getElectionManagerGroup
();
if
(
$this
->
configuration
->
isGroupConifgComplete
())
{
$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
(
...
...
Classes/Domain/Model/Configuration.php
View file @
f8b8d14d
...
...
@@ -213,6 +213,13 @@ class Configuration extends AbstractEntity
$this
->
testEmail
=
$testEmail
;
}
public
function
isGroupConifgComplete
()
{
if
(
$this
->
getAdministrationGroup
()
&&
$this
->
getElectionManagerGroup
()
&&
$this
->
getPollManagerGroup
())
{
return
true
;
}
return
false
;
}
/**
* @return Configuration
*/
...
...
Resources/Private/Language/locallang.xlf
View file @
f8b8d14d
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment