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

allow admin access to consultations on profile, fixes #414

parent 5f037373
No related branches found
No related tags found
No related merge requests found
...@@ -28,7 +28,7 @@ class Consultation_AdminController extends ConsultationController ...@@ -28,7 +28,7 @@ class Consultation_AdminController extends ConsultationController
$this->setupSidebar($action, $this->range_config); $this->setupSidebar($action, $this->range_config);
// Show information about which user is edited when a deputy edits // 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( $message = sprintf(
_('Daten von: %1$s (%2$s), Status: %3$s'), _('Daten von: %1$s (%2$s), Status: %3$s'),
htmlReady($this->range->getFullName()), htmlReady($this->range->getFullName()),
...@@ -735,7 +735,7 @@ class Consultation_AdminController extends ConsultationController ...@@ -735,7 +735,7 @@ class Consultation_AdminController extends ConsultationController
} }
foreach ($slot_ids as $slot_id) { foreach ($slot_ids as $slot_id) {
list($block_id, $slot_id) = explode('-', $slot_id); [$block_id, $slot_id] = explode('-', $slot_id);
try { try {
if ($slot = $this->loadSlot($block_id, $slot_id)) { if ($slot = $this->loadSlot($block_id, $slot_id)) {
$slots[$slot->id] = $slot; $slots[$slot->id] = $slot;
...@@ -831,4 +831,9 @@ class Consultation_AdminController extends ConsultationController ...@@ -831,4 +831,9 @@ class Consultation_AdminController extends ConsultationController
? $this->range->getConfiguration() ? $this->range->getConfiguration()
: $GLOBALS['user']->cfg; : $GLOBALS['user']->cfg;
} }
private function isOwnProfile()
{
return $this->range->username === $GLOBALS['user']->username;
}
} }
...@@ -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
|| $GLOBALS['perm']->have_profile_perm('admin', $this->user_id)
|| Deputy::isDeputy($user_id, $this->user_id, true) || Deputy::isDeputy($user_id, $this->user_id, true)
|| self::find($user_id)->perms === 'root'; || 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