001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.security.permission;
016    
017    import com.liferay.portal.model.User;
018    
019    import javax.portlet.PortletRequest;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public interface PermissionChecker {
025    
026            public static final long[] DEFAULT_ROLE_IDS = new long[] {0};
027    
028            public long getCompanyId();
029    
030            public long getOwnerRoleId();
031    
032            public long[] getRoleIds(long userId, long groupId);
033    
034            public long getUserId();
035    
036            public boolean hasOwnerPermission(
037                    long companyId, String name, long primKey, long ownerId,
038                    String actionId);
039    
040            public boolean hasOwnerPermission(
041                    long companyId, String name, String primKey, long ownerId,
042                    String actionId);
043    
044            public boolean hasPermission(
045                    long groupId, String name, long primKey, String actionId);
046    
047            public boolean hasPermission(
048                    long groupId, String name, String primKey, String actionId);
049    
050            public boolean hasUserPermission(
051                    long groupId, String name, String primKey, String actionId,
052                    boolean checkAdmin);
053    
054            public void init(User user, boolean checkGuest);
055    
056            public boolean isCommunityAdmin(long groupId);
057    
058            public boolean isCommunityOwner(long groupId);
059    
060            public boolean isCompanyAdmin();
061    
062            public boolean isCompanyAdmin(long companyId);
063    
064            public boolean isOmniadmin();
065    
066            public void resetValues();
067    
068            public void setCheckGuest(boolean checkGuest);
069    
070            public void setValues(PortletRequest portletRequest);
071    
072    }