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.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 List<String> getModelNames();
096    
097            public List<String> getModelPortletResources(String name);
098    
099            public String getModelResource(HttpServletRequest request, String name);
100    
101            public String getModelResource(Locale locale, String name);
102    
103            public List<String> getModelResourceActions(String name);
104    
105            public List<String> getModelResourceGroupDefaultActions(String name);
106    
107            public List<String> getModelResourceGuestDefaultActions(String name);
108    
109            public List<String> getModelResourceGuestUnsupportedActions(String name);
110    
111            public String getModelResourceNamePrefix();
112    
113            public List<String> getModelResourceOwnerDefaultActions(String name);
114    
115            public Double getModelResourceWeight(String name);
116    
117            public String[] getOrganizationModelResources();
118    
119            public String[] getPortalModelResources();
120    
121            public String getPortletBaseResource(String portletName);
122    
123            public List<String> getPortletModelResources(String portletName);
124    
125            public List<String> getPortletNames();
126    
127            public List<String> getPortletResourceActions(Portlet portlet);
128    
129            public List<String> getPortletResourceActions(String name);
130    
131            public List<String> getPortletResourceGroupDefaultActions(String name);
132    
133            public List<String> getPortletResourceGuestDefaultActions(String name);
134    
135            public List<String> getPortletResourceGuestUnsupportedActions(String name);
136    
137            public List<String> getPortletResourceLayoutManagerActions(String name);
138    
139            public String getPortletRootModelResource(String portletName);
140    
141            public List<String> getResourceActions(String name);
142    
143            public List<String> getResourceActions(
144                    String portletResource, String modelResource);
145    
146            public List<String> getResourceGroupDefaultActions(String name);
147    
148            public List<String> getResourceGuestUnsupportedActions(
149                    String portletResource, String modelResource);
150    
151            /**
152             * @deprecated As of 6.1.0, replaced by {@link #getRoles(long, Group,
153             *             String, int[])}
154             */
155            @Deprecated
156            public List<Role> getRoles(
157                    long companyId, Group group, String modelResource);
158    
159            public List<Role> getRoles(
160                    long companyId, Group group, String modelResource, int[] roleTypes);
161    
162            public boolean hasModelResourceActions(String name);
163    
164            public boolean isOrganizationModelResource(String modelResource);
165    
166            public boolean isPortalModelResource(String modelResource);
167    
168            public void read(
169                            String servletContextName, ClassLoader classLoader, String source)
170                    throws Exception;
171    
172            /**
173             * @deprecated As of 7.0.0
174             */
175            @Deprecated
176            public void read(String servletContextName, InputStream inputStream)
177                    throws Exception;
178    
179    }