Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-55718 #417

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
e1691a0
LPS-56194 AggregateFilter not properly handling cache timestamp checks
rotty3000 Jun 4, 2015
59fae05
LPS-49879 The 'Country' section of any 'Address' field is 'undefined'
pei-jung Jun 3, 2015
c7f6fba
LPS-55440 Add general action form to user panel layout type
adolfopa May 14, 2015
aadd373
LPS-56104 - If the user is a guest, set plid so that it is not always 0.
Jun 4, 2015
9d2aa0f
LPS-56104 SF
BryanEngler Jun 5, 2015
d6b74c0
LPS-55995 We should use the live site group when enabling staging.
May 29, 2015
2bed321
LPS-55995 Use live site group Id to search users.
May 29, 2015
746c8a8
LPS-54009 Copy layout criterions to criteria api [no logic changes]
robertoDiaz Jun 6, 2015
a20b3a4
LPS-54009 Rename and change generic [no logic changes]
robertoDiaz Jun 6, 2015
6b42f7d
LPS-54009 Extend BaseItemSelectorCriterion
robertoDiaz Jun 6, 2015
d25e2e3
LPS-54009 expose package
robertoDiaz Jun 6, 2015
318783d
LPS-54009 Delete useless fields
robertoDiaz Jun 6, 2015
e0f1d9e
LPS-56192 Add base class for legacy struts portlets
adolfopa Jun 8, 2015
f61d530
LPS-56192 Add more general method and maintain compatibility
adolfopa Jun 8, 2015
f7e962d
LPS-55718 Creates RolesAdminPortlet class
drewbrokke Jun 2, 2015
97b252e
LPS-55718 Moves EditRoleAction, no logic changes
drewbrokke Jun 2, 2015
8f2ef35
LPS-55718 Makes methods public, no logic changes
drewbrokke Jun 2, 2015
600b2c6
LPS-55718 Uses MVC methods and exception handling
drewbrokke Jun 2, 2015
c7fd37d
LPS-55718 Moves EditRoleAssignmentsAction, no logic changes
drewbrokke Jun 2, 2015
f31c143
LPS-55718 Makes methods public, no logic changes
drewbrokke Jun 2, 2015
c25ce73
LPS-55718 Uses MVC methods and exception handling
drewbrokke Jun 2, 2015
a682840
LPS-55718 Moves deletePermission method from EditRolePermissionsActio…
drewbrokke Jun 3, 2015
e4ae964
LPS-55718 Changes EditRolePermissionAction to UpdateActionsActionCommand
drewbrokke Jun 3, 2015
9093589
LPS-55718 Removes unused struts paths
drewbrokke Jun 3, 2015
3211650
LPS-55718 Removes struts paths and tiles defs
drewbrokke Jun 3, 2015
8296c80
LPS-55718 Converts to MVC Portlet
drewbrokke Jun 3, 2015
0cb2865
LPS-55718 Adds new fetch method
drewbrokke Jun 3, 2015
92f63c4
LPS-55718 Regen RoleService
drewbrokke Jun 3, 2015
7170e3c
LPS-55718 Rename and consolidate portlet methods for use in jsps
drewbrokke Jun 3, 2015
74114b5
LPS-55718 Update exception redirects
drewbrokke Jun 5, 2015
41b73b5
LPS-55718 jsps - uses new fetch method instead of ActionUtil
drewbrokke Jun 5, 2015
3323980
LPS-55718 jsps - change 'struts_action' to 'mvcPath'
drewbrokke Jun 4, 2015
e77b648
LPS-55718 jsps - prepend full path
drewbrokke Jun 4, 2015
d1c664c
LPS-55718 jsps - add '.jsp' extension
drewbrokke Jun 4, 2015
b251326
LPS-55718 jsps - Fix view_resource urls
drewbrokke Jun 4, 2015
5b52894
LPS-55718 jsps - fix actionURLs
drewbrokke Jun 5, 2015
147f1cc
LPS-55718 jsps - fix view users link
drewbrokke Jun 5, 2015
db78730
LPS-55718 jsps - fix assignment action redirect
drewbrokke Jun 5, 2015
b5a33be
LPS-55718 jsps - remove unnecessary CMD fields
drewbrokke Jun 5, 2015
413ba2d
LPS-55718 Fix urls in other portlets
drewbrokke Jun 5, 2015
e792d6e
LPS-55718 Removes use of roles ActionUtil from portal
drewbrokke Jun 5, 2015
78cc9d0
LPS-55718 ant format-source
drewbrokke Jun 5, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -3,5 +3,6 @@ Bundle-SymbolicName: com.liferay.item.selector.criteria.api
Bundle-Version: 1.0.0
Export-Package:\
com.liferay.item.selector.criteria.file.criterion,\
com.liferay.item.selector.criteria.image.criterion
com.liferay.item.selector.criteria.image.criterion,\
com.liferay.item.selector.criteria.url.criterion
Include-Resource: classes
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.liferay.item.selector.criteria.url.criterion;

import com.liferay.item.selector.BaseItemSelectorCriterion;

import java.net.URL;

import java.util.Set;
import java.util.UUID;

/**
* @author Roberto Díaz
*/
public class URLItemSelectorCriterion extends BaseItemSelectorCriterion {

public URLItemSelectorCriterion() {
super(_AVAILABLE_RETURN_TYPES);
}

private static final Set<Class<?>> _AVAILABLE_RETURN_TYPES =
getInmutableSet(URL.class, UUID.class);

}
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.liferay.item.selector.criteria.url.handler;

import com.liferay.item.selector.BaseItemSelectorCriterionHandler;
import com.liferay.item.selector.ItemSelectorCriterionHandler;
import com.liferay.item.selector.criteria.url.criterion.URLItemSelectorCriterion;

import org.osgi.service.component.annotations.Component;

/**
* @author Roberto Díaz
*/
@Component(service = ItemSelectorCriterionHandler.class)
public class URLItemSelectorCriterionHandler
extends BaseItemSelectorCriterionHandler<URLItemSelectorCriterion> {

@Override
public Class<URLItemSelectorCriterion> getItemSelectorCriterionClass() {
return URLItemSelectorCriterion.class;
}

}
Expand Up @@ -32,4 +32,8 @@
</aui:row>
</aui:container>
</c:otherwise>
</c:choose>
</c:choose>

<form action="#" id="hrefFm" method="post" name="hrefFm">
<span></span>
</form>
Expand Up @@ -45,7 +45,6 @@ page import="com.liferay.portal.service.UserLocalServiceUtil" %><%@
page import="com.liferay.portlet.PortletURLUtil" %><%@
page import="com.liferay.portlet.rolesadmin.search.RoleSearch" %><%@
page import="com.liferay.portlet.rolesadmin.search.RoleSearchTerms" %><%@
page import="com.liferay.portlet.sites.action.ActionUtil" %><%@
page import="com.liferay.portlet.sites.search.OrganizationRoleUserChecker" %><%@
page import="com.liferay.portlet.sites.search.UserGroupGroupRoleUserGroupChecker" %><%@
page import="com.liferay.portlet.sites.search.UserGroupRoleUserChecker" %><%@
Expand Down
Expand Up @@ -33,7 +33,9 @@ if (group != null) {

String groupDescriptiveName = group.getDescriptiveName(locale);

Role role = ActionUtil.getRole(request);
long roleId = ParamUtil.getLong(request, "roleId");

Role role = RoleLocalServiceUtil.fetchRole(roleId);

if (role != null) {
String roleName = role.getName();
Expand All @@ -43,8 +45,6 @@ if (role != null) {
}
}

long roleId = BeanParamUtil.getLong(role, request, "roleId");

int roleType = ParamUtil.getInteger(request, "roleType", RoleConstants.TYPE_SITE);

Organization organization = null;
Expand Down
Expand Up @@ -30,6 +30,10 @@ Team team = TeamLocalServiceUtil.fetchTeam(teamId);

Group group = GroupLocalServiceUtil.getGroup(team.getGroupId());

if (group != null) {
group = StagingUtil.getLiveGroup(group.getGroupId());
}

Organization organization = null;

if (group.isOrganization()) {
Expand Down
Expand Up @@ -24,6 +24,8 @@ int cur = (Integer)request.getAttribute("edit_team_assignments.jsp-cur");

String redirect = (String)request.getAttribute("edit_team_assignments.jsp-redirect");

Group group = (Group)request.getAttribute("edit_team_assignments.jsp-group");

Team team = (Team)request.getAttribute("edit_team_assignments.jsp-team");

PortletURL portletURL = (PortletURL)request.getAttribute("edit_team_assignments.jsp-portletURL");
Expand Down Expand Up @@ -58,7 +60,7 @@ PortletURL portletURL = (PortletURL)request.getAttribute("edit_team_assignments.
LinkedHashMap<String, Object> userParams = new LinkedHashMap<String, Object>();

userParams.put("inherit", Boolean.TRUE);
userParams.put("usersGroups", team.getGroupId());
userParams.put("usersGroups", group.getGroupId());

if (tabs2.equals("current")) {
userParams.put("usersTeams", team.getTeamId());
Expand Down
Expand Up @@ -32,6 +32,7 @@ page import="com.liferay.portal.kernel.dao.search.ResultRow" %><%@
page import="com.liferay.portal.kernel.dao.search.SearchContainer" %><%@
page import="com.liferay.portal.kernel.language.LanguageUtil" %><%@
page import="com.liferay.portal.kernel.portlet.LiferayWindowState" %><%@
page import="com.liferay.portal.kernel.staging.StagingUtil" %><%@
page import="com.liferay.portal.kernel.util.ArrayUtil" %><%@
page import="com.liferay.portal.kernel.util.HtmlUtil" %><%@
page import="com.liferay.portal.kernel.util.ParamUtil" %><%@
Expand Down
Expand Up @@ -24,6 +24,7 @@
* @author Brian Wing Shun Chan
* @author Hugo Huijser
*/
@JSON(strict = true)
public class CountryImpl extends CountryBaseImpl {

@Override
Expand Down
Expand Up @@ -653,6 +653,37 @@ public static com.liferay.portal.model.Role updateRole(
}
}

public static com.liferay.portal.model.Role fetchRole(
HttpPrincipal httpPrincipal, long roleId)
throws com.liferay.portal.kernel.exception.PortalException {
try {
MethodKey methodKey = new MethodKey(RoleServiceUtil.class,
"fetchRole", _fetchRoleParameterTypes20);

MethodHandler methodHandler = new MethodHandler(methodKey, roleId);

Object returnObj = null;

try {
returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
}
catch (Exception e) {
if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
throw (com.liferay.portal.kernel.exception.PortalException)e;
}

throw new com.liferay.portal.kernel.exception.SystemException(e);
}

return (com.liferay.portal.model.Role)returnObj;
}
catch (com.liferay.portal.kernel.exception.SystemException se) {
_log.error(se, se);

throw se;
}
}

private static Log _log = LogFactoryUtil.getLog(RoleServiceHttp.class);
private static final Class<?>[] _addRoleParameterTypes0 = new Class[] {
java.lang.String.class, long.class, java.lang.String.class,
Expand Down Expand Up @@ -720,4 +751,7 @@ public static com.liferay.portal.model.Role updateRole(
java.util.Map.class, java.lang.String.class,
com.liferay.portal.service.ServiceContext.class
};
private static final Class<?>[] _fetchRoleParameterTypes20 = new Class[] {
long.class
};
}
Expand Up @@ -521,5 +521,19 @@ public static com.liferay.portal.model.RoleSoap updateRole(long roleId,
}
}

public static com.liferay.portal.model.RoleSoap fetchRole(long roleId)
throws RemoteException {
try {
com.liferay.portal.model.Role returnValue = RoleServiceUtil.fetchRole(roleId);

return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
}
catch (Exception e) {
_log.error(e, e);

throw new RemoteException(e.getMessage());
}
}

private static Log _log = LogFactoryUtil.getLog(RoleServiceSoap.class);
}
Expand Up @@ -23,7 +23,6 @@
import com.liferay.portal.model.LayoutRevision;
import com.liferay.portal.model.PortletPreferencesIds;
import com.liferay.portal.model.User;
import com.liferay.portal.model.UserConstants;
import com.liferay.portal.security.auth.PrincipalThreadLocal;
import com.liferay.portal.service.LayoutLocalServiceUtil;
import com.liferay.portal.service.LayoutRevisionLocalServiceUtil;
Expand Down Expand Up @@ -217,14 +216,13 @@ protected Object getPreferences(MethodInvocation methodInvocation)
return methodInvocation.proceed();
}

long userId = PrincipalThreadLocal.getUserId();
User user = UserLocalServiceUtil.fetchUser(
PrincipalThreadLocal.getUserId());

if (userId == UserConstants.USER_ID_DEFAULT) {
if ((user == null) || user.isDefaultUser()) {
plid = layoutRevision.getLayoutRevisionId();
}
else {
User user = UserLocalServiceUtil.getUserById(userId);

plid = StagingUtil.getRecentLayoutRevisionId(
user, layoutRevision.getLayoutSetBranchId(),
layoutRevision.getPlid());
Expand Down
Expand Up @@ -170,6 +170,14 @@ public void deleteRole(long roleId) throws PortalException {
roleLocalService.deleteRole(roleId);
}

@Override
public Role fetchRole(long roleId) throws PortalException {
RolePermissionUtil.check(
getPermissionChecker(), roleId, ActionKeys.VIEW);

return roleLocalService.fetchRole(roleId);
}

/**
* Returns all the roles associated with the group.
*
Expand Down
Expand Up @@ -21,7 +21,6 @@
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.servlet.BrowserSniffer;
import com.liferay.portal.kernel.servlet.BufferCacheServletResponse;
import com.liferay.portal.kernel.servlet.FileTimestampUtil;
import com.liferay.portal.kernel.servlet.HttpHeaders;
import com.liferay.portal.kernel.servlet.PortalWebResourceConstants;
import com.liferay.portal.kernel.servlet.PortalWebResourcesUtil;
Expand Down Expand Up @@ -281,21 +280,10 @@ protected Object getBundleContent(
File cacheFile = new File(_tempDir, cacheFileName);

if (cacheFile.exists()) {
boolean staleCache = false;

for (String fileName : fileNames) {
long lastModified = FileTimestampUtil.getTimestamp(
jsServletContext,
bundleDirName.concat(StringPool.SLASH).concat(fileName));

if (lastModified > cacheFile.lastModified()) {
staleCache = true;

break;
}
}
long lastModified = PortalWebResourcesUtil.getLastModified(
PortalWebResourceConstants.RESOURCE_TYPE_JS);

if (!staleCache) {
if (lastModified <= cacheFile.lastModified()) {
response.setContentType(ContentTypes.TEXT_JAVASCRIPT);

return cacheFile;
Expand Down
Expand Up @@ -99,8 +99,7 @@ public void execute(
PortletURL portletURL = PortletURLFactoryUtil.create(
request, portletId, plid, PortletRequest.RENDER_PHASE);

portletURL.setParameter(
"struts_action", getStrutsAction(request, portletId));
addRequiredParameters(request, portletId, portletURL);

boolean inheritRedirect = ParamUtil.getBoolean(
request, "inheritRedirect");
Expand Down Expand Up @@ -158,10 +157,6 @@ public void execute(
@Override
public abstract String getPrimaryKeyParameterName();

@Override
public abstract String getStrutsAction(
HttpServletRequest request, String portletId);

@Override
public abstract String[] initPortletIds();

Expand Down Expand Up @@ -324,6 +319,9 @@ protected BaseFindActionHelper() {
}
}

protected abstract void addRequiredParameters(
HttpServletRequest request, String portletId, PortletURL portletURL);

private static final Log _log = LogFactoryUtil.getLog(
BaseFindActionHelper.class);

Expand Down
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/

package com.liferay.portal.struts;

import javax.portlet.PortletURL;

import javax.servlet.http.HttpServletRequest;

/**
* @author Adolfo Pérez
*/
public abstract class BaseStrutsPortletFindActionHelper
extends BaseFindActionHelper implements StrutsPortletFindActionHelper {

@Override
public abstract String getStrutsAction(
HttpServletRequest request, String portletId);

@Override
protected void addRequiredParameters(
HttpServletRequest request, String portletId, PortletURL portletURL) {

portletURL.setParameter(
"struts_action", getStrutsAction(request, portletId));
}

}
2 changes: 1 addition & 1 deletion portal-impl/src/com/liferay/portal/struts/FindAction.java
Expand Up @@ -30,7 +30,7 @@
public abstract class FindAction extends Action {

public FindAction() {
_findActionHelper = new BaseFindActionHelper() {
_findActionHelper = new BaseStrutsPortletFindActionHelper() {

@Override
public long getGroupId(long primaryKey) throws Exception {
Expand Down