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