Search in sources :

Example 6 with LectureBlockRefImpl

use of org.olat.modules.lecture.model.LectureBlockRefImpl in project openolat by klemens.

the class LectureBlocksWebService method getLectureBlockWebService.

/**
 * To get the web service for a specific lecture block.
 * @param lectureBlockKey The primary key of the lecture block
 * @param httpRequest The HTTP request
 * @return The web service for a single lecture block.
 */
@Path("{lectureBlockKey}")
public LectureBlockWebService getLectureBlockWebService(@PathParam("lectureBlockKey") Long lectureBlockKey, @Context HttpServletRequest httpRequest) {
    Roles roles = getRoles(httpRequest);
    if (!roles.isOLATAdmin()) {
        return null;
    }
    LectureBlock lectureBlock = lectureService.getLectureBlock(new LectureBlockRefImpl(lectureBlockKey));
    if (lectureBlock == null || !lectureBlock.getEntry().equals(entry)) {
        return null;
    }
    return new LectureBlockWebService(lectureBlock, entry, lectureService);
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) LectureBlockRefImpl(org.olat.modules.lecture.model.LectureBlockRefImpl) RestSecurityHelper.getRoles(org.olat.restapi.security.RestSecurityHelper.getRoles) Roles(org.olat.core.id.Roles) Path(javax.ws.rs.Path)

Aggregations

LectureBlock (org.olat.modules.lecture.LectureBlock)6 LectureBlockRefImpl (org.olat.modules.lecture.model.LectureBlockRefImpl)6 URI (java.net.URI)4 Date (java.util.Date)4 HttpResponse (org.apache.http.HttpResponse)4 HttpPut (org.apache.http.client.methods.HttpPut)4 Test (org.junit.Test)4 Identity (org.olat.core.id.Identity)4 ICourse (org.olat.course.ICourse)4 LectureBlockVO (org.olat.modules.lecture.restapi.LectureBlockVO)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 CourseConfigVO (org.olat.restapi.support.vo.CourseConfigVO)4 Path (javax.ws.rs.Path)2 Roles (org.olat.core.id.Roles)2 RestSecurityHelper.getRoles (org.olat.restapi.security.RestSecurityHelper.getRoles)2