Merge pull request #5441 from christianbeeznest/ofaj-21538-2

Internal: Resolve resource file access and null checks in session links - refs BT#21538
pull/5442/head
christianbeeznest 2 years ago committed by GitHub
commit cc88561eb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      src/CoreBundle/Security/Authorization/Voter/ResourceNodeVoter.php

@ -159,6 +159,18 @@ class ResourceNodeVoter extends Voter
}
$links = $resourceNode->getResourceLinks();
$firstLink = $resourceNode->getResourceLinks()->first();
if ($resourceNode->hasResourceFile() && $firstLink) {
if (0 === $courseId && $firstLink->getCourse() instanceof Course) {
$courseId = (int) $firstLink->getCourse()->getId();
}
if (0 === $sessionId && $firstLink->getSession() instanceof Session) {
$sessionId = (int) $firstLink->getSession()->getId();
}
if (0 === $groupId && $firstLink->getGroup() instanceof CGroup) {
$groupId = (int) $firstLink->getGroup()->getIid();
}
}
$linkFound = 0;
$link = null;

Loading…
Cancel
Save