001    /**
002     * Copyright (c) 2000-2012 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.auth;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.model.Group;
020    import com.liferay.portal.model.Organization;
021    import com.liferay.portal.model.Role;
022    import com.liferay.portal.model.User;
023    import com.liferay.portal.model.UserGroup;
024    import com.liferay.portal.security.permission.PermissionChecker;
025    
026    import java.util.Set;
027    
028    /**
029     * @author Sergio González
030     */
031    public interface MembershipPolicy {
032    
033            public Set<Group> getForbiddenGroups(User user);
034    
035            public Set<Organization> getForbiddenOrganizations(User user);
036    
037            public Set<Role> getForbiddenRoles(Group group, User user);
038    
039            public Set<Role> getForbiddenRoles(Organization organization, User user);
040    
041            public Set<Role> getForbiddenRoles(User user);
042    
043            public Set<UserGroup> getForbiddenUserGroups(User user);
044    
045            public Set<Group> getMandatoryGroups(User user);
046    
047            public Set<Organization> getMandatoryOrganizations(User user);
048    
049            public Set<Role> getMandatoryRoles(Group group, User user);
050    
051            public Set<Role> getMandatoryRoles(Organization organization, User user);
052    
053            public Set<Role> getMandatoryRoles(User user);
054    
055            public Set<UserGroup> getMandatoryUserGroups(User user);
056    
057            public boolean isApplicableUser(User user);
058    
059            public boolean isMembershipAllowed(Group group, Role role, User user);
060    
061            public boolean isMembershipAllowed(Group group, User user);
062    
063            public boolean isMembershipAllowed(
064                    Organization organization, Role role, User user);
065    
066            public boolean isMembershipAllowed(Organization organization, User user);
067    
068            public boolean isMembershipAllowed(Role role, User user);
069    
070            public boolean isMembershipAllowed(UserGroup userGroup, User user);
071    
072            public boolean isMembershipProtected(
073                            PermissionChecker permissionChecker, Group group, Role role,
074                            User user)
075                    throws PortalException, SystemException;
076    
077            public boolean isMembershipProtected(
078                            PermissionChecker permissionChecker, Group group, User user)
079                    throws PortalException, SystemException;
080    
081            public boolean isMembershipProtected(
082                            PermissionChecker permissionChecker, Organization organization,
083                            Role role, User user)
084                    throws SystemException;
085    
086            public boolean isMembershipProtected(
087                            PermissionChecker permissionChecker, Organization organization,
088                            User user)
089                    throws PortalException, SystemException;
090    
091    }