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.Organization;
021    import com.liferay.portal.model.PasswordPolicy;
022    import com.liferay.portal.model.Portlet;
023    import com.liferay.portal.model.Role;
024    import com.liferay.portal.model.User;
025    import com.liferay.portal.model.UserGroup;
026    import com.liferay.portlet.expando.model.ExpandoColumn;
027    
028    import java.io.InputStream;
029    
030    import java.util.List;
031    import java.util.Locale;
032    
033    import javax.servlet.jsp.PageContext;
034    
035    /**
036     * @author Brian Wing Shun Chan
037     * @author Daeyoung Song
038     */
039    public interface ResourceActions {
040    
041            /**
042             * @deprecated As of 6.2.0, replaced by {@link #getActionNamePrefix}
043             */
044            public static final String ACTION_NAME_PREFIX = "action.";
045    
046            /**
047             * @deprecated As of 6.2.0, replaced by {@link #getModelResourceNamePrefix}
048             */
049            public static final String MODEL_RESOURCE_NAME_PREFIX = "model.resource.";
050    
051            /**
052             * @deprecated As of 6.2.0, replaced by {@link
053             *             #getOrganizationModelResources}
054             */
055            public static final String[] ORGANIZATION_MODEL_RESOURCES = {
056                    Organization.class.getName(), PasswordPolicy.class.getName(),
057                    User.class.getName()
058            };
059    
060            /**
061             * @deprecated As of 6.2.0, replaced by {@link #getPortalModelResources}
062             */
063            public static final String[] PORTAL_MODEL_RESOURCES = {
064                    ExpandoColumn.class.getName(), Organization.class.getName(),
065                    PasswordPolicy.class.getName(), Role.class.getName(),
066                    User.class.getName(), UserGroup.class.getName()
067            };
068    
069            public void checkAction(String name, String actionId)
070                    throws NoSuchResourceActionException;
071    
072            public String getAction(Locale locale, String action);
073    
074            public String getAction(PageContext pageContext, String action);
075    
076            public String getActionNamePrefix();
077    
078            public List<String> getActionsNames(
079                    PageContext pageContext, List<String> actions);
080    
081            public List<String> getActionsNames(
082                    PageContext pageContext, String name, long actionIds);
083    
084            public List<String> getModelNames();
085    
086            public List<String> getModelPortletResources(String name);
087    
088            public String getModelResource(Locale locale, String name);
089    
090            public String getModelResource(PageContext pageContext, String name);
091    
092            public List<String> getModelResourceActions(String name);
093    
094            public List<String> getModelResourceGroupDefaultActions(String name);
095    
096            public List<String> getModelResourceGuestDefaultActions(String name);
097    
098            public List<String> getModelResourceGuestUnsupportedActions(String name);
099    
100            public String getModelResourceNamePrefix();
101    
102            public List<String> getModelResourceOwnerDefaultActions(String name);
103    
104            public Double getModelResourceWeight(String name);
105    
106            public String[] getOrganizationModelResources();
107    
108            public String[] getPortalModelResources();
109    
110            public String getPortletBaseResource(String portletName);
111    
112            public List<String> getPortletModelResources(String portletName);
113    
114            public List<String> getPortletNames();
115    
116            public List<String> getPortletResourceActions(Portlet portlet);
117    
118            public List<String> getPortletResourceActions(String name);
119    
120            public List<String> getPortletResourceGroupDefaultActions(String name);
121    
122            public List<String> getPortletResourceGuestDefaultActions(String name);
123    
124            public List<String> getPortletResourceGuestUnsupportedActions(String name);
125    
126            public List<String> getPortletResourceLayoutManagerActions(String name);
127    
128            public String getPortletRootModelResource(String portletName);
129    
130            public List<String> getResourceActions(String name);
131    
132            public List<String> getResourceActions(
133                    String portletResource, String modelResource);
134    
135            public List<String> getResourceGroupDefaultActions(String name);
136    
137            public List<String> getResourceGuestUnsupportedActions(
138                    String portletResource, String modelResource);
139    
140            /**
141             * @deprecated As of 6.1.0, replaced by {@link #getRoles(long, Group,
142             *             String, int[])}
143             */
144            public List<Role> getRoles(
145                            long companyId, Group group, String modelResource)
146                    throws SystemException;
147    
148            public List<Role> getRoles(
149                            long companyId, Group group, String modelResource, int[] roleTypes)
150                    throws SystemException;
151    
152            public boolean hasModelResourceActions(String name);
153    
154            public boolean isOrganizationModelResource(String modelResource);
155    
156            public boolean isPortalModelResource(String modelResource);
157    
158            public void read(
159                            String servletContextName, ClassLoader classLoader, String source)
160                    throws Exception;
161    
162            public void read(String servletContextName, InputStream inputStream)
163                    throws Exception;
164    
165    }