View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services;
18  
19  // Jetspeed imports
20  import org.apache.jetspeed.om.security.JetspeedUser;
21  import org.apache.jetspeed.om.profile.Entry;
22  import org.apache.jetspeed.portal.Portlet;
23  import org.apache.jetspeed.services.security.PortalAccessController;
24  import org.apache.jetspeed.services.security.PortalResource;
25  
26  // Turbine
27  import org.apache.turbine.services.TurbineServices;
28  
29  /***
30   * Static accessor for the PortalAccessController service
31   *
32   * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
33   * @version $Id: JetspeedPortalAccessController.java,v 1.3 2004/02/23 04:00:57 jford Exp $
34   */
35  public abstract class JetspeedPortalAccessController
36  {
37      
38      /*** Creates new JetspeedIdGenerator */
39      public JetspeedPortalAccessController()
40      {
41      }
42      
43      /*
44       * Utility method for accessing the service
45       * implementation
46       *
47       * @return a UniqueIdService implementation instance
48       */
49      protected static PortalAccessController getService()
50      {
51          return (PortalAccessController)TurbineServices
52          .getInstance().getService(PortalAccessController.SERVICE_NAME);
53      }
54      
55      public static boolean checkPermission(JetspeedUser user, Entry entry, String action)
56      {
57          return getService().checkPermission(user, entry, action);
58      }
59  
60      public static boolean checkPermission(JetspeedUser user, Portlet portlet, String action)
61      {
62          return getService().checkPermission(user, portlet, action);
63      }
64  
65      public static boolean checkPermission(JetspeedUser user, PortalResource resource, String action)
66      {
67          return getService().checkPermission(user, resource, action);
68      }
69      
70  }