@Test public void shouldAddPermissionForUsersWhenUsingChainExtension() throws OperationException { List<String> users = Arrays.asList("jchastain", "rdeniro", "dwashington"); users.forEach(user -> when(userManager.getUserModel(user)).thenReturn(SimpleDocumentModel.ofSchemas(user))); DocumentModel doc = session.getDocument(new PathRef("/src")); ctx.setInput(doc); DocumentModel documentModel = (DocumentModel) automationService.run(ctx, "testAddPermissionToUsers"); ACP acp = documentModel.getACP(); assertNotNull(acp); ACL acl = acp.getACL("local"); assertNotNull(acl); Map<String, Object> params = Collections.singletonMap("permission", SecurityConstants.READ); Assert.assertTrue(acl.getACEs().length >= 3); for (String user : users) { assertExpectedPermissions(acl, params, user); } }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel doc) { validateParameters(); addPermission(doc); return doc; }
AddPermission { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel doc) { validateParameters(); addPermission(doc); return doc; } }
AddPermission { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel doc) { validateParameters(); addPermission(doc); return doc; }  }
AddPermission { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel doc) { validateParameters(); addPermission(doc); return doc; }  @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentModel doc); @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentRef docRef); }
AddPermission { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel doc) { validateParameters(); addPermission(doc); return doc; }  @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentModel doc); @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentRef docRef); static final String ID; static final String NOTIFY_KEY; static final String COMMENT_KEY; static final String ALLOW_VIRTUAL_USER; }