validate($request); $user = $this->getUser($request); if (!$related = ForumEntry::find($args['id'])) { throw new RecordNotFoundException(); } if (!$course = \Course::find($related->seminar_id)) { throw new RecordNotFoundException('Could not find course.'); } if (!ForumAuthority::has($this->getUser($request), 'view', $course)) { throw new AuthorizationFailedException(); } if (!$entry = $this->createEntryFromJSON($user, $related->id, $json)) { throw new InternalServerError('could not create forum-entry'); } return $this->getCreatedResponse($entry); } }