Browse code

BM-14614 Fix: c&r store client sudo

David Phan authored on 11/04/2019 10:16:22
Showing 1 changed files
... ...
@@ -28,8 +28,6 @@ import org.slf4j.LoggerFactory;
28 28
 
29 29
 import com.google.common.collect.ImmutableSet;
30 30
 
31
-import net.bluemind.authentication.api.IAuthentication;
32
-import net.bluemind.authentication.api.LoginResponse;
33 31
 import net.bluemind.backend.mail.replica.api.MailReplicaContainerTypes;
34 32
 import net.bluemind.config.Token;
35 33
 import net.bluemind.core.api.report.DiagnosticReport;
... ...
@@ -46,6 +44,7 @@ import net.bluemind.imap.IMAPException;
46 44
 import net.bluemind.imap.ListInfo;
47 45
 import net.bluemind.imap.ListResult;
48 46
 import net.bluemind.imap.StoreClient;
47
+import net.bluemind.index.mail.Sudo;
49 48
 import net.bluemind.mailbox.api.IMailboxes;
50 49
 import net.bluemind.mailbox.api.Mailbox;
51 50
 import net.bluemind.server.api.IServer;
... ...
@@ -119,12 +118,10 @@ public class ReplicationParentUidRepair implements IDirEntryRepairSupport {
119 118
 		}
120 119
 
121 120
 		public void folders(BiConsumer<StoreClient, ListResult> process) {
122
-			IAuthentication iAuth = context.provider().instance(IAuthentication.class,
123
-					context.getSecurityContext().getSessionId());
124 121
 			String login = mbox.value.name + "@" + domainUid;
125
-			LoginResponse su = iAuth.su(login);
126 122
 
127
-			try (StoreClient sc = new StoreClient(srv.address(), 1143, login, su.authKey)) {
123
+			try (Sudo sudo = new Sudo(mbox.value.name, domainUid);
124
+					StoreClient sc = new StoreClient(srv.address(), 1143, login, sudo.context.getSessionId())) {
128 125
 				if (!sc.login()) {
129 126
 					logger.error("Fail to connect", mbox.value.name);
130 127
 					return;