KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > event > CheckOwnerInterceptor


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.faces.core.event;
6
7 import javax.faces.context.ExternalContext;
8 import javax.faces.context.FacesContext;
9 import org.exoplatform.commons.exception.ExoMessageException;
10 import org.exoplatform.container.SessionContainer;
11 import org.exoplatform.portal.session.RequestInfo;
12 /**
13  * Jun 3, 2004
14  * @author: Tuan Nguyen
15  * @email: tuan08@users.sourceforge.net
16  * @version: $ID$
17  **/

18 public class CheckOwnerInterceptor extends ActionInterceptor {
19     
20     public void preExecute(ExoActionEvent event) throws Exception JavaDoc {
21     ExternalContext econtext = FacesContext.getCurrentInstance().getExternalContext() ;
22     RequestInfo rinfo = (RequestInfo)SessionContainer.getComponent(RequestInfo.class) ;
23     if(rinfo.getPortalOwner().equals(econtext.getRemoteUser())) {
24       return ;
25     }
26     Object JavaDoc[] args = {event.getAction()} ;
27     throw new ExoMessageException("CheckOwnerInterceptor.msg.owner-require", args) ;
28   }
29     
30     final public void postExecute(ExoActionEvent event) throws Exception JavaDoc {
31         
32     }
33 }
Popular Tags