...
|
...
|
@@ -25,7 +25,6 @@ package net.bluemind.backend.mail.replica.service.tests;
|
25
|
25
|
import static org.junit.Assert.assertEquals;
|
26
|
26
|
import static org.junit.Assert.assertFalse;
|
27
|
27
|
import static org.junit.Assert.assertTrue;
|
28
|
|
-import static org.junit.Assert.fail;
|
29
|
28
|
|
30
|
29
|
import java.util.List;
|
31
|
30
|
import java.util.concurrent.CountDownLatch;
|
...
|
...
|
@@ -46,8 +45,6 @@ import net.bluemind.backend.mail.replica.api.MailboxSub;
|
46
|
45
|
import net.bluemind.backend.mail.replica.api.QuotaRoot;
|
47
|
46
|
import net.bluemind.backend.mail.replica.api.SeenOverlay;
|
48
|
47
|
import net.bluemind.backend.mail.replica.api.SieveScript;
|
49
|
|
-import net.bluemind.core.api.fault.ErrorCode;
|
50
|
|
-import net.bluemind.core.api.fault.ServerFault;
|
51
|
48
|
import net.bluemind.core.context.SecurityContext;
|
52
|
49
|
import net.bluemind.core.elasticsearch.ElasticsearchTestHelper;
|
53
|
50
|
import net.bluemind.core.jdbc.JdbcTestHelper;
|
...
|
...
|
@@ -188,43 +185,6 @@ public class CyrusArtifactsServiceTests {
|
188
|
185
|
service.deleteAnnotation(ma);
|
189
|
186
|
}
|
190
|
187
|
|
191
|
|
- @Test
|
192
|
|
- public void testAnnotationsAsUser() {
|
193
|
|
- ICyrusReplicationAnnotations service = getAnnotationsService(userContext.getSecurityContext());
|
194
|
|
- MailboxAnnotation ma = new MailboxAnnotation();
|
195
|
|
- ma.mailbox = "test.lab!user.another";
|
196
|
|
- ma.userId = "another@test.lab";
|
197
|
|
- ma.entry = "the_key";
|
198
|
|
- ma.value = "id";
|
199
|
|
- try {
|
200
|
|
- service.storeAnnotation(ma);
|
201
|
|
- fail("another does not exist");
|
202
|
|
- } catch (ServerFault sf) {
|
203
|
|
- assertEquals(ErrorCode.NOT_FOUND, sf.getCode());
|
204
|
|
- }
|
205
|
|
-
|
206
|
|
- MailboxAnnotation noRights = new MailboxAnnotation();
|
207
|
|
- noRights.mailbox = "test.lab!user.german^pr0n";
|
208
|
|
- noRights.userId = "german.pr0n@test.lab";
|
209
|
|
- noRights.entry = "the_key";
|
210
|
|
- noRights.value = "id";
|
211
|
|
- try {
|
212
|
|
- service.storeAnnotation(noRights);
|
213
|
|
- fail("ACLs should block the store annotation call");
|
214
|
|
- } catch (ServerFault sf) {
|
215
|
|
- sf.printStackTrace();
|
216
|
|
- assertEquals(ErrorCode.PERMISSION_DENIED, sf.getCode());
|
217
|
|
- }
|
218
|
|
-
|
219
|
|
- MailboxAnnotation myBox = new MailboxAnnotation();
|
220
|
|
- myBox.mailbox = "test.lab!user.user.Sent";
|
221
|
|
- myBox.userId = "user@test.lab";
|
222
|
|
- myBox.entry = "the_key";
|
223
|
|
- myBox.value = "id";
|
224
|
|
- service.storeAnnotation(myBox);
|
225
|
|
-
|
226
|
|
- }
|
227
|
|
-
|
228
|
188
|
protected ICyrusReplicationArtifacts getArtifactsService(SecurityContext ctx) {
|
229
|
189
|
return ServerSideServiceProvider.getProvider(ctx).instance(ICyrusReplicationArtifacts.class, "user@test.lab");
|
230
|
190
|
}
|