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