Skip to content

Commit

Permalink
Fix object for Acl check in showComponent (#1915)
Browse files Browse the repository at this point in the history
Update showComponent to always use parent object for Acl check.
  • Loading branch information
anvit committed Feb 14, 2025
1 parent 83b6a5a commit fc387cc
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions apps/qubit/modules/digitalobject/actions/showComponent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,14 @@ public function execute($request)
*/
private function checkShowGenericIcon()
{
$resourceObject = $this->resource->object;

// Get the parent resouce (IO or Actor) for Acl check
// if resource->object is empty and parent exists
if (!$resourceObject && $this->resouce->parent) {
$resourceObject = $this->resource->parent->object;
}

switch ($this->usageType) {
case QubitTerm::REFERENCE_ID:
return !QubitAcl::check($resourceObject, 'readReference');
// Use the parent resource (IO or Actor) for Acl check
return !QubitAcl::check($this->resource->parent->object, 'readReference');

case QubitTerm::THUMBNAIL_ID:
return !QubitAcl::check($resourceObject, 'readThumbnail');
// Use the parent resource (IO or Actor) for Acl check
return !QubitAcl::check($this->resource->parent->object, 'readThumbnail');
}
}

Expand Down

0 comments on commit fc387cc

Please sign in to comment.