1 16 package org.apache.cocoon.portal.tools.acting; 17 18 import java.util.Map ; 19 20 import org.apache.avalon.framework.parameters.Parameters; 21 import org.apache.avalon.framework.thread.ThreadSafe; 22 import org.apache.cocoon.ProcessingException; 23 import org.apache.cocoon.acting.ServiceableAction; 24 import org.apache.cocoon.environment.Redirector; 25 import org.apache.cocoon.environment.SourceResolver; 26 import org.apache.cocoon.portal.tools.PortalToolManager; 27 import org.apache.cocoon.portal.tools.service.UserRightsService; 28 29 34 public class CheckAccessAction 35 extends ServiceableAction 36 implements ThreadSafe { 37 38 41 public Map act(Redirector redirector, 42 SourceResolver resolver, 43 Map objectModel, 44 String source, 45 Parameters parameters) 46 throws Exception { 47 String url = parameters.getParameter("url"); 48 PortalToolManager ptm = (PortalToolManager) this.manager.lookup(PortalToolManager.ROLE); 49 try { 50 UserRightsService userRightsService = ptm.getUserRightsService(); 51 if (!userRightsService.userIsAllowed(url, ptm.getPortalObjects().getPortalService().getComponentManager().getProfileManager().getUser())) { 53 throw new ProcessingException( 54 "You are not allowed to request this page."); 55 } 56 } finally { 57 this.manager.release(ptm); 58 } 59 return EMPTY_MAP; 60 } 61 62 } | Popular Tags |