01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/presentation/api-impl/src/java/org/theospi/portfolio/presentation/model/impl/PresentationHttpAccess.java $
03: * $Id:PresentationHttpAccess.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.theospi.portfolio.presentation.model.impl;
21:
22: import org.sakaiproject.content.api.ContentHostingService;
23: import org.sakaiproject.entity.api.EntityAccessOverloadException;
24: import org.sakaiproject.entity.api.EntityCopyrightException;
25: import org.sakaiproject.entity.api.EntityNotDefinedException;
26: import org.sakaiproject.entity.api.EntityPermissionException;
27: import org.sakaiproject.entity.api.Reference;
28: import org.sakaiproject.metaobj.shared.mgt.IdManager;
29: import org.sakaiproject.metaobj.shared.mgt.ReferenceParser;
30: import org.sakaiproject.tool.cover.SessionManager;
31: import org.theospi.portfolio.presentation.PresentationManager;
32: import org.theospi.portfolio.presentation.model.Presentation;
33: import org.theospi.portfolio.security.AuthorizationFailedException;
34: import org.theospi.portfolio.security.mgt.OspHttpAccessBase;
35:
36: /**
37: * Created by IntelliJ IDEA.
38: * User: John Ellis
39: * Date: Nov 8, 2005
40: * Time: 2:39:25 PM
41: * To change this template use File | Settings | File Templates.
42: */
43: public class PresentationHttpAccess extends OspHttpAccessBase {
44:
45: private PresentationManager presentationManager;
46: private IdManager idManager;
47:
48: protected void checkSource(Reference ref, ReferenceParser parser)
49: throws EntityPermissionException,
50: EntityNotDefinedException, EntityAccessOverloadException,
51: EntityCopyrightException {
52:
53: try {
54: Presentation pres = presentationManager
55: .getPresentation(getIdManager().getId(
56: parser.getId()));
57: if (pres == null) {
58: throw new EntityNotDefinedException(parser.getId());
59: }
60: } catch (AuthorizationFailedException exp) {
61: throw new EntityPermissionException(SessionManager
62: .getCurrentSessionUserId(),
63: ContentHostingService.EVENT_RESOURCE_READ, ref
64: .getReference());
65: }
66: }
67:
68: public PresentationManager getPresentationManager() {
69: return presentationManager;
70: }
71:
72: public void setPresentationManager(
73: PresentationManager presentationManager) {
74: this .presentationManager = presentationManager;
75: }
76:
77: public IdManager getIdManager() {
78: return idManager;
79: }
80:
81: public void setIdManager(IdManager idManager) {
82: this.idManager = idManager;
83: }
84: }
|