@Test @Deploy("org.nuxeo.ecm.automation.core:test-allow-virtual-user.xml") public void shouldAddPermissionForUnexistingGroupsWhenAllowVirtualUserFlagIsTrue() throws OperationException { DocumentModel doc = session.getDocument(new PathRef("/src")); assertNotNull(doc.getACP()); assertNull(doc.getACP().getACL("local")); List<String> groups = Arrays.asList("unexistingGroup1", "unexistingGroup2"); groups.forEach(group -> when(userManager.getGroupModel(group)).thenReturn(null)); ctx.setInput(doc); Map<String, Object> params = getParametersForAddOperation(null, groups, null, "Read", null, new GregorianCalendar(2018, 8, 2), new GregorianCalendar(2018, 8, 8), false, true, "Permission Given"); automationService.run(ctx, AddPermission.ID, params); verifyZeroInteractions(userManager); ACL acl = doc.getACP().getACL("local"); assertNotNull(acl); assertEquals(2, acl.size()); assertExpectedPermissions(acl, params, "unexistingGroup1"); assertExpectedPermissions(acl, params, "unexistingGroup2"); }
@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; }