Skip to content

Commit

Permalink
Add assets to the set of resource fields to check against
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdryden committed May 4, 2023
1 parent 3b35a27 commit d152a54
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2309,8 +2309,10 @@ public function teamAuthority(EntityInterface $resource, $action, Event $event)
'Omeka\Entity\Item',
'Omeka\Entity\ItemSet',
'Omeka\Entity\Media',
'Omeka\Entity\Asset',
'Omeka\Entity\ResourceTemplate',
'Teams\Entity\TeamResource'
'Teams\Entity\TeamResource',
'Teams\Entity\TeamAsset',
];

if (in_array($res_class, $resource_domains)) {
Expand Down Expand Up @@ -2384,8 +2386,6 @@ public function teamAuthority(EntityInterface $resource, $action, Event $event)
}
}



//a list of classes where we don't need to check teams
//TODO: this should be refactored and go with the checks in the beginning
elseif ($res_class == 'Omeka\Entity\User') {
Expand All @@ -2396,8 +2396,6 @@ public function teamAuthority(EntityInterface $resource, $action, Event $event)
return true;
} elseif ($res_class == 'Teams\Entity\TeamRole') {
$authorized = $is_glob_admin;
} elseif ($res_class == "Omeka\Entity\Asset") {
return true;
}

//don't police other modules by default
Expand All @@ -2408,10 +2406,7 @@ public function teamAuthority(EntityInterface $resource, $action, Event $event)
if (!$authorized) {
$authorized = false;
$msg = sprintf(
// $this->getTranslator()->translate(
'Permission denied. Your role in %5$s, %4$s, does not permit you to %3$s this resource.'

// )
,
get_class($resource),
$resource->getId(),
Expand All @@ -2420,10 +2415,7 @@ public function teamAuthority(EntityInterface $resource, $action, Event $event)
$team->getName()
);
$diagnostic = sprintf(
// $this->getTranslator()->translate(
'Diagnostic: -- Resource type: %1$s. Resource id: %2$s. Action: %3$s. Your role: %4$s'

// )
,
get_class($resource),
$resource->getId(),
Expand Down

0 comments on commit d152a54

Please sign in to comment.