Skip to content
Snippets Groups Projects
Commit b0d59e65 authored by Robert Lange's avatar Robert Lange Committed by Dorian Merz
Browse files

refs #16586 [finc] set permission handling for I18nController

* extend AbstractAdmin to check for access permission for AdminModule
** admin module must be activated in config.ini by admin_enabled = true
** permission access.AdminModule should be set in permissions.ini
parent 4983010a
No related merge requests found
......@@ -20,18 +20,17 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
namespace finc\Controller\Admin;
use Symfony\Component\Filesystem\Filesystem as Fs;
use VuFind\Auth\InvalidArgumentException;
use VuFind\Config\Writer as ConfigWriter;
use VuFind\Controller\AbstractBase;
use VuFind\I18n\Translator\Loader\ExtendedIni;
use VuFindAdmin\Controller\AbstractAdmin;
use Zend\I18n\Translator\Translator;
use Zend\ServiceManager\ServiceLocatorInterface;
class I18nController extends AbstractBase
class I18nController extends AbstractAdmin
{
/**
* @var string[]
......@@ -89,7 +88,6 @@ class I18nController extends AbstractBase
$this->languages = array_combine($locales, $languages);
}
public function homeAction()
{
$params = $this->params();
......@@ -165,7 +163,6 @@ class I18nController extends AbstractBase
$locale,
$reset ? null : $value
);
}
protected function getTranslations(): array
......@@ -243,14 +240,13 @@ class I18nController extends AbstractBase
protected function saveTranslation($domain, $token, $locale, $value)
{
$fs = new FS();
list($filename) = array_slice($this->dirs, -1);;
list($filename) = array_slice($this->dirs, -1);
if ($domain !== 'default') {
$filename .= "/$domain";
}
$filename .= "/$locale.ini";
try {
if (empty($token)) {
throw new InvalidArgumentException(
$this->translate('This field is required') . ": Token"
......@@ -366,4 +362,4 @@ class I18nController extends AbstractBase
$response->setStatusCode(205);
return $response;
}
}
\ No newline at end of file
}
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