Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/lib/Limitation/OwnerLimitationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,12 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse
);
}

$versionCreatorId = null;
if ($object instanceof Content) {
$versionCreatorId = $object->getVersionInfo()->creatorId;
$object = $object->getVersionInfo()->getContentInfo();
} elseif ($object instanceof VersionInfo) {
$versionCreatorId = $object->creatorId;
$object = $object->getContentInfo();
} elseif (!$object instanceof ContentInfo && !$object instanceof ContentCreateStruct) {
throw new InvalidArgumentException(
Expand All @@ -141,9 +144,10 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse
* @var $object ContentInfo
*/
$isOwner = $object->ownerId === $userId;
$isVersionCreator = $versionCreatorId !== null && $versionCreatorId === $userId;
$isSelf = $object instanceof ContentInfo && $object->id === $userId;

return $isOwner || $isSelf;
return $isOwner || $isVersionCreator || $isSelf;
}

/**
Expand Down
Loading