Skip to content
Snippets Groups Projects
Commit 0fe45573 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

fixes #389

parent ad2256c7
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,21 @@ class Consultation_AdminController extends ConsultationController ...@@ -26,6 +26,21 @@ class Consultation_AdminController extends ConsultationController
$this->range_config = $this->range->getConfiguration(); $this->range_config = $this->range->getConfiguration();
$this->setupSidebar($action, $this->range_config); $this->setupSidebar($action, $this->range_config);
// Show information about which user is edited when a deputy edits
if ($this->range instanceof User && Deputy::isDeputy($GLOBALS['user']->id, $this->range->id, true)) {
$message = sprintf(
_('Daten von: %1$s (%2$s), Status: %3$s'),
htmlReady($this->range->getFullName()),
htmlReady($this->range->username),
htmlReady($this->range->perms)
);
PageLayout::postMessage(
MessageBox::info($message)
, 'settings-user-anncouncement'
);
}
} }
private function groupSlots(array $slots) private function groupSlots(array $slots)
...@@ -442,7 +457,7 @@ class Consultation_AdminController extends ConsultationController ...@@ -442,7 +457,7 @@ class Consultation_AdminController extends ConsultationController
{ {
if ($what === 'messages') { if ($what === 'messages') {
// TODO: Applicable everywhere? // TODO: Applicable everywhere?
$GLOBALS['user']->cfg->store( $this->getUserConfig()->store(
'CONSULTATION_SEND_MESSAGES', 'CONSULTATION_SEND_MESSAGES',
(bool) $state (bool) $state
); );
...@@ -453,7 +468,7 @@ class Consultation_AdminController extends ConsultationController ...@@ -453,7 +468,7 @@ class Consultation_AdminController extends ConsultationController
(bool) $state (bool) $state
); );
} elseif ($what === 'grouped') { } elseif ($what === 'grouped') {
$GLOBALS['user']->cfg->store( $this->getUserConfig()->store(
'CONSULTATION_SHOW_GROUPED', 'CONSULTATION_SHOW_GROUPED',
(bool) $state (bool) $state
); );
...@@ -733,7 +748,7 @@ class Consultation_AdminController extends ConsultationController ...@@ -733,7 +748,7 @@ class Consultation_AdminController extends ConsultationController
$options = $sidebar->addWidget(new OptionsWidget()); $options = $sidebar->addWidget(new OptionsWidget());
$options->addCheckbox( $options->addCheckbox(
_('Benachrichtungen über Buchungen'), _('Benachrichtungen über Buchungen'),
$GLOBALS['user']->cfg->CONSULTATION_SEND_MESSAGES, $this->getUserConfig()->getValue('CONSULTATION_SEND_MESSAGES'),
$this->toggleURL('messages/1', $action === 'expired'), $this->toggleURL('messages/1', $action === 'expired'),
$this->toggleURL('messages/0', $action === 'expired') $this->toggleURL('messages/0', $action === 'expired')
); );
...@@ -745,7 +760,7 @@ class Consultation_AdminController extends ConsultationController ...@@ -745,7 +760,7 @@ class Consultation_AdminController extends ConsultationController
); );
$options->addCheckbox( $options->addCheckbox(
_('Termine gruppiert anzeigen'), _('Termine gruppiert anzeigen'),
$GLOBALS['user']->cfg->CONSULTATION_SHOW_GROUPED, $this->getUserConfig()->getValue('CONSULTATION_SHOW_GROUPED'),
$this->toggleURL('grouped/1', $action === 'expired'), $this->toggleURL('grouped/1', $action === 'expired'),
$this->toggleURL('grouped/0', $action === 'expired') $this->toggleURL('grouped/0', $action === 'expired')
); );
...@@ -774,4 +789,11 @@ class Consultation_AdminController extends ConsultationController ...@@ -774,4 +789,11 @@ class Consultation_AdminController extends ConsultationController
Request::get("{$index}-time") Request::get("{$index}-time")
])); ]));
} }
private function getUserConfig(): RangeConfig
{
return $this->range instanceof User
? $this->range->getConfiguration()
: $GLOBALS['user']->cfg;
}
} }
...@@ -1413,6 +1413,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject ...@@ -1413,6 +1413,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
$user_id = $GLOBALS['user']->id; $user_id = $GLOBALS['user']->id;
} }
return $user_id === $this->user_id return $user_id === $this->user_id
|| Deputy::isDeputy($user_id, $this->user_id, true)
|| self::find($user_id)->perms === 'root'; || self::find($user_id)->perms === 'root';
} }
......
<?php <?php
class ConsultationNavigation extends Navigation class ConsultationNavigation extends Navigation
{ {
/** @var Range */
protected $range; protected $range;
public function __construct(Range $range) public function __construct(Range $range)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment