1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.permission;
16  
17  import com.liferay.portal.PortalException;
18  import com.liferay.portal.SystemException;
19  import com.liferay.portal.model.Portlet;
20  import com.liferay.portal.security.permission.PermissionChecker;
21  
22  /**
23   * <a href="PortletPermissionUtil.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Brian Wing Shun Chan
26   */
27  public class PortletPermissionUtil {
28  
29      public static void check(
30              PermissionChecker permissionChecker, long groupId, long plid,
31              String portletId, String actionId, boolean strict)
32          throws PortalException, SystemException {
33  
34          getPortletPermission().check(
35              permissionChecker, groupId, plid, portletId, actionId, strict);
36      }
37  
38      public static void check(
39              PermissionChecker permissionChecker, long plid, String portletId,
40              String actionId)
41          throws PortalException, SystemException {
42  
43          getPortletPermission().check(
44              permissionChecker, plid, portletId, actionId);
45      }
46  
47      public static void check(
48              PermissionChecker permissionChecker, long plid, String portletId,
49              String actionId, boolean strict)
50          throws PortalException, SystemException {
51  
52          getPortletPermission().check(
53              permissionChecker, plid, portletId, actionId, strict);
54      }
55  
56      public static void check(
57              PermissionChecker permissionChecker, String portletId,
58              String actionId)
59          throws PortalException, SystemException {
60  
61          getPortletPermission().check(permissionChecker, portletId, actionId);
62      }
63  
64      public static boolean contains(
65              PermissionChecker permissionChecker, long groupId, long plid,
66              String portletId, String actionId, boolean strict)
67          throws PortalException, SystemException {
68  
69          return getPortletPermission().contains(
70              permissionChecker, groupId, plid, portletId, actionId, strict);
71      }
72  
73      public static boolean contains(
74              PermissionChecker permissionChecker, long plid, Portlet portlet,
75              String actionId)
76          throws PortalException, SystemException {
77  
78          return getPortletPermission().contains(
79              permissionChecker, plid, portlet, actionId);
80      }
81  
82      public static boolean contains(
83              PermissionChecker permissionChecker, long plid, Portlet portlet,
84              String actionId, boolean strict)
85          throws PortalException, SystemException {
86  
87          return getPortletPermission().contains(
88              permissionChecker, plid, portlet, actionId, strict);
89      }
90  
91      public static boolean contains(
92              PermissionChecker permissionChecker, long plid, String portletId,
93              String actionId)
94          throws PortalException, SystemException {
95  
96          return getPortletPermission().contains(
97              permissionChecker, plid, portletId, actionId);
98      }
99  
100     public static boolean contains(
101             PermissionChecker permissionChecker, long plid, String portletId,
102             String actionId, boolean strict)
103         throws PortalException, SystemException {
104 
105         return getPortletPermission().contains(
106             permissionChecker, plid, portletId, actionId, strict);
107     }
108 
109     public static boolean contains(
110             PermissionChecker permissionChecker, String portletId,
111             String actionId)
112         throws PortalException, SystemException {
113 
114         return getPortletPermission().contains(
115             permissionChecker, portletId, actionId);
116     }
117 
118     public static PortletPermission getPortletPermission() {
119         return _portletPermission;
120     }
121 
122     public static String getPrimaryKey(long plid, String portletId) {
123         return getPortletPermission().getPrimaryKey(plid, portletId);
124     }
125 
126     public static boolean hasLayoutManagerPermission(
127         String portletId, String actionId) {
128 
129         return getPortletPermission().hasLayoutManagerPermission(
130             portletId, actionId);
131     }
132 
133     public void setPortletPermission(PortletPermission portletPermission) {
134         _portletPermission = portletPermission;
135     }
136 
137     private static PortletPermission _portletPermission;
138 
139 }