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

allow admin access to consultations on profile, fixes #414

parent 031fa7b2
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ class Consultation_AdminController extends ConsultationController
$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)) {
if ($this->range instanceof User && !$this->isOwnProfile()) {
$message = sprintf(
_('Daten von: %1$s (%2$s), Status: %3$s'),
htmlReady($this->range->getFullName()),
......@@ -735,7 +735,7 @@ class Consultation_AdminController extends ConsultationController
}
foreach ($slot_ids as $slot_id) {
list($block_id, $slot_id) = explode('-', $slot_id);
[$block_id, $slot_id] = explode('-', $slot_id);
try {
if ($slot = $this->loadSlot($block_id, $slot_id)) {
$slots[$slot->id] = $slot;
......@@ -831,4 +831,9 @@ class Consultation_AdminController extends ConsultationController
? $this->range->getConfiguration()
: $GLOBALS['user']->cfg;
}
private function isOwnProfile()
{
return $this->range->username === $GLOBALS['user']->username;
}
}
......@@ -1413,6 +1413,7 @@ class User extends AuthUserMd5 implements Range, PrivacyObject
$user_id = $GLOBALS['user']->id;
}
return $user_id === $this->user_id
|| $GLOBALS['perm']->have_profile_perm('admin', $this->user_id)
|| Deputy::isDeputy($user_id, $this->user_id, true)
|| self::find($user_id)->perms === 'root';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment