getUser($request); if (!Authority::canIndexStructuralElementsShared($user)) { throw new AuthorizationFailedException(); } list($offset, $limit) = $this->getOffsetAndLimit(); $resources = []; $contents = StructuralElement::findBySQL( 'range_id != ? AND range_type = ? ORDER BY mkdate DESC', [$user->id, 'user'] ); foreach ($contents as $content) { if (!count($content->read_approval) || !count($content->write_approval)) { continue; } $add_content = false; foreach ($content->read_approval['users'] as $listedUserPerm) { if ($listedUserPerm['id'] == $user->id && $listedUserPerm['read']) { $add_content = true; } } foreach ($content->write_approval['users'] as $listedUserPerm) { if ($listedUserPerm['id'] == $user->id && $listedUserPerm['read']) { $add_content = true; } } if ($add_content) { $resources[] = $content; } } return $this->getPaginatedContentResponse($resources, count($resources)); } }