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

correct calls to StructualElement::canRead(), fixes #4815

Closes #4815

Merge request studip/studip!3605
parent cd04aafb
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ class Courseware_LtiController extends AuthenticatedController ...@@ -11,7 +11,7 @@ class Courseware_LtiController extends AuthenticatedController
public function iframe_action($block_id) public function iframe_action($block_id)
{ {
$cw_block = \Courseware\Block::find($block_id); $cw_block = \Courseware\Block::find($block_id);
if (!$cw_block->container->structural_element->canRead($GLOBALS['user']->id)) { if (!$cw_block->container->structural_element->canRead(User::findCurrent())) {
throw new AccessDeniedException(); throw new AccessDeniedException();
} }
......
...@@ -118,7 +118,7 @@ class GlobalSearchCourseware extends GlobalSearchModule implements GlobalSearchF ...@@ -118,7 +118,7 @@ class GlobalSearchCourseware extends GlobalSearchModule implements GlobalSearchF
{ {
$structural_element = StructuralElement::find($data['id']); $structural_element = StructuralElement::find($data['id']);
$unit = $structural_element->findUnit(); $unit = $structural_element->findUnit();
if ($unit && $structural_element->canRead($GLOBALS['user'])) { if ($unit && $structural_element->canRead(User::findCurrent())) {
$description = ''; $description = '';
if ($data['type'] === 'cw_structural_elements') { if ($data['type'] === 'cw_structural_elements') {
$description = self::mark($structural_element->payload['description'], $search, true); $description = self::mark($structural_element->payload['description'], $search, true);
......
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