Skip to content
Snippets Groups Projects
Commit da3c47c4 authored by Viktoria Wiebe's avatar Viktoria Wiebe Committed by David Siegfried
Browse files

fix #1047 - add perm check for user context

Closes #1047

Merge request studip/studip!1095
parent 99cce644
No related branches found
No related tags found
No related merge requests found
...@@ -262,6 +262,10 @@ class Authority ...@@ -262,6 +262,10 @@ class Authority
public static function canUpdateBlockComment(User $user, BlockComment $resource) public static function canUpdateBlockComment(User $user, BlockComment $resource)
{ {
if ($resource->block->container->structural_element->range_type === 'user') {
return $resource->block->container->structural_element->range_id === $user->id;
}
$perm = $GLOBALS['perm']->have_studip_perm( $perm = $GLOBALS['perm']->have_studip_perm(
$resource->block->container->structural_element->course->config->COURSEWARE_EDITING_PERMISSION, $resource->block->container->structural_element->course->config->COURSEWARE_EDITING_PERMISSION,
$resource->block->container->structural_element->course->id, $resource->block->container->structural_element->course->id,
...@@ -383,6 +387,10 @@ class Authority ...@@ -383,6 +387,10 @@ class Authority
return true; return true;
} }
if ($resource->structural_element->range_type === 'user') {
return $resource->structural_element->range_id === $user->id;
}
$perm = $GLOBALS['perm']->have_studip_perm( $perm = $GLOBALS['perm']->have_studip_perm(
$resource->structural_element->course->config->COURSEWARE_EDITING_PERMISSION, $resource->structural_element->course->config->COURSEWARE_EDITING_PERMISSION,
$resource->structural_element->course->id, $resource->structural_element->course->id,
...@@ -408,6 +416,10 @@ class Authority ...@@ -408,6 +416,10 @@ class Authority
return true; return true;
} }
if ($resource->range_type === 'user') {
return $resource->range_id === $user->id;
}
$perm = $GLOBALS['perm']->have_studip_perm( $perm = $GLOBALS['perm']->have_studip_perm(
$resource->course->config->COURSEWARE_EDITING_PERMISSION, $resource->course->config->COURSEWARE_EDITING_PERMISSION,
$resource->course->id, $resource->course->id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment