Skip to content
Snippets Groups Projects
Commit 4a134aff authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Jan-Hendrik Willms
Browse files

fixes #3477

Closes #3477

Merge request studip/studip!2373
parent 1f398b65
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,10 @@ class Consultation_AdminController extends ConsultationController
{
parent::before_filter($action, $args);
if (!$this->range || $action === 'not_found') {
return;
}
if (!$this->range->isEditableByUser()) {
throw new AccessDeniedException();
}
......
......@@ -12,14 +12,21 @@ abstract class ConsultationController extends AuthenticatedController
{
parent::before_filter($action, $args);
$type = 'person';
if (Request::submitted('username')) {
$this->range = User::findByUsername(Request::username('username'));
} elseif (Request::submitted('cid')) {
$this->range = Context::get();
$type = 'object';
} else {
$this->range = $GLOBALS['user']->getAuthenticatedUser();
}
if (!$this->range) {
$this->redirect($this->not_foundURL($type));
return;
}
if ($this->range instanceof User) {
URLHelper::addLinkParam('username', $this->range->username);
} elseif ($this->range instanceof Course || $this->range instanceof Institute) {
......@@ -47,6 +54,12 @@ abstract class ConsultationController extends AuthenticatedController
};
}
public function not_found_action(string $type): void
{
$this->type = $type;
$this->render_template('consultation/not_found', $this->layout);
}
protected function activateNavigation($path)
{
$path = ltrim($path, '/');
......
......@@ -14,6 +14,10 @@ class Consultation_OverviewController extends ConsultationController
{
parent::before_filter($action, $args);
if (!$this->range) {
return;
}
if ($this->range->isEditableByUser()) {
$this->redirect('consultation/admin');
}
......
<?php
/**
* @var string $type
*/
?>
<?= MessageBox::error(
$type === 'person'
? _('Die Person, für die die Sprechstunden angezeigt werden sollen, ist nicht mehr vorhanden')
: _('Das Objekt, für das die Sprechstunden angezeigt werden sollen, ist nicht mehr vorhanden')
)->hideClose() ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment