001    /**
002     * Copyright (c) 2000-2013 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.NoSuchResourceActionException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.model.Group;
020    import com.liferay.portal.model.Permission;
021    import com.liferay.portal.model.Portlet;
022    import com.liferay.portal.model.Role;
023    
024    import java.io.InputStream;
025    
026    import java.util.List;
027    import java.util.Locale;
028    
029    import javax.servlet.jsp.PageContext;
030    
031    /**
032     * @author Brian Wing Shun Chan
033     * @author Daeyoung Song
034     */
035    public interface ResourceActions {
036    
037            public void checkAction(String name, String actionId)
038                    throws NoSuchResourceActionException;
039    
040            public String getAction(Locale locale, String action);
041    
042            public String getAction(PageContext pageContext, String action);
043    
044            public String getActionNamePrefix();
045    
046            public List<String> getActions(List<Permission> permissions);
047    
048            public List<String> getActionsNames(
049                    PageContext pageContext, List<String> actions);
050    
051            public List<String> getActionsNames(
052                    PageContext pageContext, String name, long actionIds);
053    
054            public List<String> getModelNames();
055    
056            public List<String> getModelPortletResources(String name);
057    
058            public String getModelResource(Locale locale, String name);
059    
060            public String getModelResource(PageContext pageContext, String name);
061    
062            public List<String> getModelResourceActions(String name);
063    
064            public List<String> getModelResourceGroupDefaultActions(String name);
065    
066            public List<String> getModelResourceGuestDefaultActions(String name);
067    
068            public List<String> getModelResourceGuestUnsupportedActions(String name);
069    
070            public String getModelResourceNamePrefix();
071    
072            public List<String> getModelResourceOwnerDefaultActions(String name);
073    
074            public String[] getOrganizationModelResources();
075    
076            public String[] getPortalModelResources();
077    
078            public String getPortletBaseResource(String portletName);
079    
080            public List<String> getPortletModelResources(String portletName);
081    
082            public List<String> getPortletNames();
083    
084            public List<String> getPortletResourceActions(Portlet portlet);
085    
086            public List<String> getPortletResourceActions(String name);
087    
088            public List<String> getPortletResourceGroupDefaultActions(String name);
089    
090            public List<String> getPortletResourceGuestDefaultActions(String name);
091    
092            public List<String> getPortletResourceGuestUnsupportedActions(String name);
093    
094            public List<String> getPortletResourceLayoutManagerActions(String name);
095    
096            public List<String> getResourceActions(String name);
097    
098            public List<String> getResourceActions(
099                    String portletResource, String modelResource);
100    
101            public List<String> getResourceGroupDefaultActions(String name);
102    
103            public List<String> getResourceGuestUnsupportedActions(
104                    String portletResource, String modelResource);
105    
106            /**
107             * @deprecated {@link #getRoles(long, Group, String, int[])}
108             */
109            public List<Role> getRoles(
110                            long companyId, Group group, String modelResource)
111                    throws SystemException;
112    
113            public List<Role> getRoles(
114                            long companyId, Group group, String modelResource, int[] roleTypes)
115                    throws SystemException;
116    
117            public boolean hasModelResourceActions(String name);
118    
119            public boolean isOrganizationModelResource(String modelResource);
120    
121            public boolean isPortalModelResource(String modelResource);
122    
123            public void read(
124                            String servletContextName, ClassLoader classLoader, String source)
125                    throws Exception;
126    
127            public void read(String servletContextName, InputStream inputStream)
128                    throws Exception;
129    
130    }