Select Git revision
ForumEntry.php
Forked from
Stud.IP / Stud.IP
Source project has a limited visibility.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
admin.php 1.93 KiB
<?php
final class AdminController extends \TracToGitlab\Controller
{
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
if (User::findCurrent()->perms !== 'root') {
throw new AccessDeniedException();
}
Navigation::activateItem('/admin/plugins/trac2gitlab');
PageLayout::setTitle(_('GitLab-Verbindung konfigurieren'));
}
public function index_action()
{
$this->gitlab_url = Config::get()->TRAC2GITLAB_GITLAB_URL;
$this->gitlab_token = Config::get()->TRAC2GITLAB_GITLAB_TOKEN;
$this->gitlab_project_id = Config::get()->TRAC2GITLAB_GITLAB_PROJECT_ID;
$this->gitlab_container_registry_id = Config::get()->TRAC2GITLAB_GITLAB_CONTAINER_REGISTRY_ID;
$this->bytist_token = Config::get()->TRAC2GITLAB_BYTIST_TOKEN;
$this->webhook_secret = Config::get()->TRAC2GITLAB_GITLAB_WEBHOOK_SECRET;
$this->systemhook_secret = Config::get()->TRAC2GITLAB_GITLAB_SYSTEMHOOK_SECRET;
}
public function store_action()
{
if (!Request::isPost()) {
throw new MethodNotAllowedException();
}
Config::get()->store('TRAC2GITLAB_GITLAB_URL', Request::get('gitlab-url'));
Config::get()->store('TRAC2GITLAB_GITLAB_TOKEN', Request::get('gitlab-token'));
Config::get()->store('TRAC2GITLAB_GITLAB_PROJECT_ID', Request::int('gitlab-project-id'));
Config::get()->store('TRAC2GITLAB_GITLAB_CONTAINER_REGISTRY_ID', Request::int('gitlab-container-registry-id'));
Config::get()->store('TRAC2GITLAB_BYTIST_TOKEN', Request::get('bytist-token'));
Config::get()->store('TRAC2GITLAB_GITLAB_WEBHOOK_SECRET', Request::get('webhook-secret'));
Config::get()->store('TRAC2GITLAB_GITLAB_SYSTEMHOOK_SECRET', Request::get('systemhook-secret'));
PageLayout::postSuccess(_('Einstellungen wurden gespeichert'));
$this->redirect($this->indexURL());
}
}