Skip to content

Commit

Permalink
Fix rights checks on document creation
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne authored and trasher committed Jul 3, 2024
1 parent 58184ac commit f656ed2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,13 @@ public function canCreateItem()
{

if (isset($this->input['itemtype']) && isset($this->input['items_id'])) {
if ($item = getItemForItemtype($this->input['itemtype'])) {
if ($item->canAddItem('Document')) {
return true;
}
if (
($item = getItemForItemtype($this->input['itemtype']))
&& $item->getFromDB($this->input['items_id'])
) {
return $item->canAddItem('Document');
} else {
unset($this->input['itemtype'], $this->input['items_id']);
}
}

Expand Down

0 comments on commit f656ed2

Please sign in to comment.