forked from liferay/liferay-portal
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-153687 Add fetchSharingCollaborators to the Info display Context #2636
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
67d23dd
LPS-153687 Add SHARING_COLLABORATORS as a type of ContentDashboardIte…
cgoncas 5f71b5b
LPS-153687 Add method isSharingCollaboratorsVisible to ContentDashboa…
cgoncas d2dd72d
LPS-153687 New sharing_collaborators.jsp that render the collaborator…
cgoncas 806e835
LPS-153687 Implement the new action for blogs.
cgoncas 6479402
LPS-152905 Implement sharing collaborators action for FileEntry
Stephy6 8fb468b
LPS-153687 Return fetchSharingContactsURL with the URL of the collabo…
cgoncas 141c5d5
LPS-153687 Baseline
cgoncas File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nt-dashboard-api/src/main/resources/com/liferay/content/dashboard/item/action/packageinfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version 1.2.0 | ||
version 1.3.0 |
111 changes: 111 additions & 0 deletions
111
.../blogs/internal/item/action/SharingCollaboratorsBlogsEntryContentDashboardItemAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/** | ||
* 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.content.dashboard.blogs.internal.item.action; | ||
|
||
import com.liferay.blogs.model.BlogsEntry; | ||
import com.liferay.content.dashboard.item.action.ContentDashboardItemAction; | ||
import com.liferay.petra.portlet.url.builder.PortletURLBuilder; | ||
import com.liferay.petra.string.StringPool; | ||
import com.liferay.portal.kernel.language.Language; | ||
import com.liferay.portal.kernel.log.Log; | ||
import com.liferay.portal.kernel.log.LogFactoryUtil; | ||
import com.liferay.portal.kernel.portlet.LiferayWindowState; | ||
import com.liferay.portal.kernel.util.JavaConstants; | ||
import com.liferay.portal.kernel.util.Portal; | ||
|
||
import java.util.Locale; | ||
|
||
import javax.portlet.PortletResponse; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
/** | ||
* @author Cristina González | ||
*/ | ||
public class SharingCollaboratorsBlogsEntryContentDashboardItemAction | ||
implements ContentDashboardItemAction { | ||
|
||
public SharingCollaboratorsBlogsEntryContentDashboardItemAction( | ||
BlogsEntry blogsEntry, HttpServletRequest httpServletRequest, | ||
Language language, Portal portal) { | ||
|
||
_blogsEntry = blogsEntry; | ||
_httpServletRequest = httpServletRequest; | ||
_language = language; | ||
_portal = portal; | ||
} | ||
|
||
@Override | ||
public String getIcon() { | ||
return "share"; | ||
} | ||
|
||
@Override | ||
public String getLabel(Locale locale) { | ||
return _language.get(locale, "share"); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "share"; | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return Type.SHARING_COLLABORATORS; | ||
} | ||
|
||
@Override | ||
public String getURL() { | ||
try { | ||
PortletResponse portletResponse = | ||
(PortletResponse)_httpServletRequest.getAttribute( | ||
JavaConstants.JAVAX_PORTLET_RESPONSE); | ||
|
||
return PortletURLBuilder.createRenderURL( | ||
_portal.getLiferayPortletResponse(portletResponse), | ||
"com_liferay_content_dashboard_web_portlet_" + | ||
"ContentDashboardAdminPortlet" | ||
).setMVCPath( | ||
"/sharing_collaborators.jsp" | ||
).setParameter( | ||
"className", BlogsEntry.class.getName() | ||
).setParameter( | ||
"classPK", _blogsEntry.getEntryId() | ||
).setWindowState( | ||
LiferayWindowState.EXCLUSIVE | ||
).buildString(); | ||
} | ||
catch (Exception exception) { | ||
_log.error(exception); | ||
|
||
return StringPool.BLANK; | ||
} | ||
} | ||
|
||
@Override | ||
public String getURL(Locale locale) { | ||
return getURL(); | ||
} | ||
|
||
private static final Log _log = LogFactoryUtil.getLog( | ||
SharingCollaboratorsBlogsEntryContentDashboardItemAction.class); | ||
|
||
private final BlogsEntry _blogsEntry; | ||
private final HttpServletRequest _httpServletRequest; | ||
private final Language _language; | ||
private final Portal _portal; | ||
|
||
} |
129 changes: 129 additions & 0 deletions
129
...tem/action/provider/SharingCollaboratorsBlogsEntryContentDashboardItemActionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/** | ||
* 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.content.dashboard.blogs.internal.item.action.provider; | ||
|
||
import com.liferay.blogs.model.BlogsEntry; | ||
import com.liferay.content.dashboard.blogs.internal.item.action.SharingCollaboratorsBlogsEntryContentDashboardItemAction; | ||
import com.liferay.content.dashboard.item.action.ContentDashboardItemAction; | ||
import com.liferay.content.dashboard.item.action.provider.ContentDashboardItemActionProvider; | ||
import com.liferay.portal.kernel.exception.PortalException; | ||
import com.liferay.portal.kernel.language.Language; | ||
import com.liferay.portal.kernel.log.Log; | ||
import com.liferay.portal.kernel.log.LogFactoryUtil; | ||
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermission; | ||
import com.liferay.portal.kernel.service.ClassNameLocalService; | ||
import com.liferay.portal.kernel.service.GroupLocalService; | ||
import com.liferay.portal.kernel.theme.ThemeDisplay; | ||
import com.liferay.portal.kernel.util.Portal; | ||
import com.liferay.portal.kernel.util.WebKeys; | ||
import com.liferay.sharing.configuration.SharingConfiguration; | ||
import com.liferay.sharing.configuration.SharingConfigurationFactory; | ||
import com.liferay.sharing.security.permission.SharingPermission; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* @author Cristina González | ||
*/ | ||
@Component(service = ContentDashboardItemActionProvider.class) | ||
public class SharingCollaboratorsBlogsEntryContentDashboardItemActionProvider | ||
implements ContentDashboardItemActionProvider<BlogsEntry> { | ||
|
||
@Override | ||
public ContentDashboardItemAction getContentDashboardItemAction( | ||
BlogsEntry blogsEntry, HttpServletRequest httpServletRequest) { | ||
|
||
if (!isShow(blogsEntry, httpServletRequest)) { | ||
return null; | ||
} | ||
|
||
return new SharingCollaboratorsBlogsEntryContentDashboardItemAction( | ||
blogsEntry, httpServletRequest, _language, _portal); | ||
} | ||
|
||
@Override | ||
public String getKey() { | ||
return "share"; | ||
} | ||
|
||
@Override | ||
public ContentDashboardItemAction.Type getType() { | ||
return ContentDashboardItemAction.Type.SHARING_COLLABORATORS; | ||
} | ||
|
||
@Override | ||
public boolean isShow( | ||
BlogsEntry blogsEntry, HttpServletRequest httpServletRequest) { | ||
|
||
ThemeDisplay themeDisplay = | ||
(ThemeDisplay)httpServletRequest.getAttribute( | ||
WebKeys.THEME_DISPLAY); | ||
|
||
try { | ||
if (_isSharingEnabled(themeDisplay.getScopeGroupId()) && | ||
_sharingPermission.containsSharePermission( | ||
themeDisplay.getPermissionChecker(), | ||
_classNameLocalService.getClassNameId( | ||
BlogsEntry.class.getName()), | ||
blogsEntry.getEntryId(), themeDisplay.getScopeGroupId())) { | ||
|
||
return true; | ||
} | ||
} | ||
catch (PortalException portalException) { | ||
_log.error(portalException); | ||
|
||
return false; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
private boolean _isSharingEnabled(long groupId) throws PortalException { | ||
SharingConfiguration sharingConfiguration = | ||
_sharingConfigurationFactory.getGroupSharingConfiguration( | ||
_groupLocalService.getGroup(groupId)); | ||
|
||
return sharingConfiguration.isEnabled(); | ||
} | ||
|
||
private static final Log _log = LogFactoryUtil.getLog( | ||
SharingCollaboratorsBlogsEntryContentDashboardItemActionProvider.class); | ||
|
||
@Reference | ||
private ClassNameLocalService _classNameLocalService; | ||
|
||
@Reference | ||
private GroupLocalService _groupLocalService; | ||
|
||
@Reference | ||
private Language _language; | ||
|
||
@Reference(target = "(model.class.name=com.liferay.blogs.model.BlogsEntry)") | ||
private ModelResourcePermission<BlogsEntry> _modelResourcePermission; | ||
|
||
@Reference | ||
private Portal _portal; | ||
|
||
@Reference | ||
private SharingConfigurationFactory _sharingConfigurationFactory; | ||
|
||
@Reference | ||
private SharingPermission _sharingPermission; | ||
|
||
} |
111 changes: 111 additions & 0 deletions
111
...library/internal/item/action/SharingCollaboratorsFileEntryContentDashboardItemAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/** | ||
* 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.content.dashboard.document.library.internal.item.action; | ||
|
||
import com.liferay.content.dashboard.item.action.ContentDashboardItemAction; | ||
import com.liferay.petra.portlet.url.builder.PortletURLBuilder; | ||
import com.liferay.petra.string.StringPool; | ||
import com.liferay.portal.kernel.language.Language; | ||
import com.liferay.portal.kernel.log.Log; | ||
import com.liferay.portal.kernel.log.LogFactoryUtil; | ||
import com.liferay.portal.kernel.portlet.LiferayWindowState; | ||
import com.liferay.portal.kernel.repository.model.FileEntry; | ||
import com.liferay.portal.kernel.util.JavaConstants; | ||
import com.liferay.portal.kernel.util.Portal; | ||
|
||
import java.util.Locale; | ||
|
||
import javax.portlet.PortletResponse; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
|
||
/** | ||
* @author Cristina González | ||
*/ | ||
public class SharingCollaboratorsFileEntryContentDashboardItemAction | ||
implements ContentDashboardItemAction { | ||
|
||
public SharingCollaboratorsFileEntryContentDashboardItemAction( | ||
FileEntry fileEntry, HttpServletRequest httpServletRequest, | ||
Language language, Portal portal) { | ||
|
||
_fileEntry = fileEntry; | ||
_httpServletRequest = httpServletRequest; | ||
_language = language; | ||
_portal = portal; | ||
} | ||
|
||
@Override | ||
public String getIcon() { | ||
return "share"; | ||
} | ||
|
||
@Override | ||
public String getLabel(Locale locale) { | ||
return _language.get(locale, "share"); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "share"; | ||
} | ||
|
||
@Override | ||
public Type getType() { | ||
return Type.SHARING_COLLABORATORS; | ||
} | ||
|
||
@Override | ||
public String getURL() { | ||
try { | ||
PortletResponse portletResponse = | ||
(PortletResponse)_httpServletRequest.getAttribute( | ||
JavaConstants.JAVAX_PORTLET_RESPONSE); | ||
|
||
return PortletURLBuilder.createRenderURL( | ||
_portal.getLiferayPortletResponse(portletResponse), | ||
"com_liferay_content_dashboard_web_portlet_" + | ||
"ContentDashboardAdminPortlet" | ||
).setMVCPath( | ||
"/sharing_collaborators_button.jsp" | ||
).setParameter( | ||
"className", FileEntry.class.getName() | ||
).setParameter( | ||
"classPK", _fileEntry.getFileEntryId() | ||
).setWindowState( | ||
LiferayWindowState.EXCLUSIVE | ||
).buildString(); | ||
} | ||
catch (Exception exception) { | ||
_log.error(exception); | ||
|
||
return StringPool.BLANK; | ||
} | ||
} | ||
|
||
@Override | ||
public String getURL(Locale locale) { | ||
return getURL(); | ||
} | ||
|
||
private static final Log _log = LogFactoryUtil.getLog( | ||
SharingCollaboratorsFileEntryContentDashboardItemAction.class); | ||
|
||
private final FileEntry _fileEntry; | ||
private final HttpServletRequest _httpServletRequest; | ||
private final Language _language; | ||
private final Portal _portal; | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cgoncas maybe we missed to rename this path to
"/sharing_collaborators.jsp"
i'm getting an error I did not realized before:
thxs!