1 5 package org.exoplatform.faces.core.event; 6 7 import javax.faces.context.* ; 8 import org.exoplatform.commons.exception.ExoPermissionException; 9 15 public class CheckRoleInterceptor extends ActionInterceptor { 16 private String role_ ; 17 18 public CheckRoleInterceptor(String role) { 19 role_ = role ; 20 } 21 22 public void preExecute(ExoActionEvent event) throws Exception { 23 ExternalContext econtext = 24 FacesContext.getCurrentInstance().getExternalContext() ; 25 if(!econtext.isUserInRole(role_)) { 26 throw new ExoPermissionException(event.getAction() , role_) ; 27 } 28 } 29 30 final public void postExecute(ExoActionEvent event) throws Exception { 31 32 } 33 } | Popular Tags |