Skip to content

Commit

Permalink
MediaObject: Make WAC checking instance more robust against indeter…
Browse files Browse the repository at this point in the history
  • Loading branch information
alex40724 committed Sep 18, 2024
1 parent e129c07 commit d941dfb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Services/MediaObjects/classes/class.ilObjMediaObjectAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ilObjMediaObjectAccess implements ilWACCheckingClass
protected ilObjectDataCache $obj_data_cache;
protected ilObjUser $user;
protected ilAccessHandler $access;
protected ilLogger $logger;

public function __construct()
{
Expand All @@ -33,6 +34,7 @@ public function __construct()
$this->obj_data_cache = $DIC["ilObjDataCache"];
$this->user = $DIC->user();
$this->access = $DIC->access();
$this->logger = $DIC->logger()->mob();
}

public function canBeDelivered(ilWACPath $ilWACPath): bool
Expand Down Expand Up @@ -71,9 +73,18 @@ protected function checkAccessMob(
break;

default:
if ($this->checkAccessMobUsage($usage, $oid)) {
if ($oid !== null && $this->checkAccessMobUsage($usage, $oid)) {
return true;
}

if ($oid === null) {
$this->logger->error(
sprintf(
"Could not determine parent obj_id for usage: %s",
json_encode($usage, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT)
)
);
}
break;
}
}
Expand Down

0 comments on commit d941dfb

Please sign in to comment.