diff --git a/.classpath b/.classpath index 165f1c5..072c06b 100644 --- a/.classpath +++ b/.classpath @@ -25,8 +25,9 @@ - + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 8b5c4dc..3a0745f 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -11,6 +11,6 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.8 diff --git a/pom.xml b/pom.xml index c380b8f..dce5c39 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ social-networking-library-ws Rest interface for the social networking library. - 1.8 + 1.8 2.14.0 2.8.11 ${project.build.directory}/${project.build.finalName} @@ -42,7 +42,7 @@ org.aspectj aspectjrt - 1.8.2 + 1.9.7 @@ -213,7 +213,12 @@ authorization-client provided - + + org.projectlombok + lombok + 1.18.2 + provided + junit junit @@ -320,7 +325,7 @@ org.codehaus.mojo aspectj-maven-plugin - 1.7 + 1.14.0 1.8 1.8 diff --git a/src/main/java/org/gcube/portal/social/networking/ws/utils/Filters.java b/src/main/java/org/gcube/portal/social/networking/ws/utils/Filters.java index 89bc663..e06b272 100644 --- a/src/main/java/org/gcube/portal/social/networking/ws/utils/Filters.java +++ b/src/main/java/org/gcube/portal/social/networking/ws/utils/Filters.java @@ -8,6 +8,7 @@ import org.gcube.portal.databook.server.DatabookStore; import org.gcube.portal.databook.shared.Comment; import org.gcube.portal.databook.shared.EnhancedFeed; import org.gcube.portal.databook.shared.Feed; +import org.gcube.portal.databook.shared.Post; import org.gcube.portal.social.networking.liferay.ws.GroupManagerWSBuilder; import org.gcube.vomanagement.usermanagement.GroupManager; import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault; @@ -92,6 +93,7 @@ public class Filters { * @param context * @throws Exception */ + @Deprecated public static void filterFeedsPerContext(List feeds, String context) throws Exception { List contexts = getContexts(context); @@ -104,6 +106,27 @@ public class Filters { iterator.remove(); } + } + /** + * Given a list of not filtered posts, the methods remove posts unaccessible in this scope. + * If the initial context is the root: all posts are returned; + * If the initial context is a VO: posts for vres within the vo are returned; + * If the initial context is a vre: posts of the vre are returned; + * @param context + * @throws Exception + */ + public static void filterPostsPerContext(List posts, String context) throws Exception { + + List contexts = getContexts(context); + + // filter + Iterator iterator = posts.iterator(); + while (iterator.hasNext()) { + Post post = (Post) iterator.next(); + if(!contexts.contains(post.getVreid())) + iterator.remove(); + } + } /**