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