Browse Source

alpha test passed

Feature/21689
Massimiliano Assante 7 months ago
parent
commit
a5ca642193
  1. 2
      .classpath
  2. 2
      .settings/org.eclipse.jdt.core.prefs
  3. 21
      src/main/java/org/gcube/portal/socialmail/PeriodicTask.java

2
.classpath

@ -26,7 +26,7 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="owner.project.facets" value="java"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>

2
.settings/org.eclipse.jdt.core.prefs

@ -3,7 +3,9 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
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.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

21
src/main/java/org/gcube/portal/socialmail/PeriodicTask.java

@ -34,6 +34,7 @@ import org.gcube.applicationsupportlayer.social.mailing.AppType;
import org.gcube.applicationsupportlayer.social.mailing.SocialMailingUtil;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingSite;
import org.gcube.applicationsupportlayer.social.shared.SocialNetworkingUser;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.authorization.library.provider.UserInfo;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
@ -258,13 +259,23 @@ public class PeriodicTask implements Runnable {
_log.debug("Found message reply, subject: " + subject + " body: " + messageText);
String newMessageId = null;
List<String> recipientIds = null;
List<String> recipientIds = new ArrayList<>();
try {
setAuthorizationToken(fakeSession);
String username = fakeSession.getUsername();
String scope = fakeSession.getScope();
ScopeProvider.instance.set(scope);
_log.debug("calling service token on scope " + scope);
List<String> userRoles = new ArrayList<>();
userRoles.add(DEFAULT_ROLE);
fakeSession.setSecurityToken(null);
String token = authorizationService().generateUserToken(new UserInfo(username, userRoles), scope);
SecurityTokenProvider.instance.set(token);
MessageManagerClient mmClient = AbstractPlugin.messages().build();
org.gcube.common.storagehub.model.messages.Message theMessage = mmClient.get(messageId);
recipientIds = Arrays.asList(theMessage.getAddresses());
org.gcube.common.storagehub.model.messages.Message theMessage = mmClient.get(messageId);
String[] addresses = theMessage.getAddresses();
for (int i = 0; i < addresses.length; i++) {
recipientIds.add(addresses[i]);
}
//add the sender and remove the person who is replying from the recipients
String sender = theMessage.getSender().getUserName();
String originalText = theMessage.getBody();

Loading…
Cancel
Save