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.security.permission;
16  
17  /**
18   * <a href="SimplePermissionChecker.java.html"><b><i>View Source</i></b></a>
19   *
20   * @author Brian Wing Shun Chan
21   */
22  public class SimplePermissionChecker extends BasePermissionChecker {
23  
24      public boolean hasOwnerPermission(
25          long companyId, String name, String primKey, long ownerId,
26          String actionId) {
27  
28          return hasPermission(actionId);
29      }
30  
31      public boolean hasPermission(
32          long groupId, String name, String primKey, String actionId) {
33  
34          return hasPermission(actionId);
35      }
36  
37      public boolean hasUserPermission(
38          long groupId, String name, String primKey, String actionId,
39          boolean checkAdmin) {
40  
41          return hasPermission(actionId);
42      }
43  
44      public boolean isCommunityAdmin(long groupId) {
45          return signedIn;
46      }
47  
48      public boolean isCommunityOwner(long groupId) {
49          return signedIn;
50      }
51  
52      public boolean isCompanyAdmin() {
53          return signedIn;
54      }
55  
56      public boolean isCompanyAdmin(long companyId) {
57          return signedIn;
58      }
59  
60      protected boolean hasPermission(String actionId) {
61          if (signedIn) {
62              return true;
63          }
64  
65          if (actionId.equals(ActionKeys.VIEW)) {
66              return true;
67          }
68          else {
69              return false;
70          }
71      }
72  
73  }