| SimplePermissionChecker.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
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 }