Skip to content
Snippets Groups Projects
Commit bd23049f authored by Viktoria Wiebe's avatar Viktoria Wiebe Committed by Jan-Hendrik Willms
Browse files

fix #1047 - add perm check for user context

Closes #1047

Merge request studip/studip!1095
parent bc88a272
No related branches found
No related tags found
No related merge requests found
...@@ -249,6 +249,10 @@ class Authority ...@@ -249,6 +249,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,
...@@ -370,6 +374,10 @@ class Authority ...@@ -370,6 +374,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,
...@@ -395,6 +403,10 @@ class Authority ...@@ -395,6 +403,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