public virtual void testProcessTaskAddGroupIdentityLinkWithUpdatePersmissionOnTask() { // given startProcessInstanceByKey(PROCESS_KEY); string taskId = selectSingleTask().Id; authRule.createGrantAuthorization(TASK, taskId, userId, UPDATE); // when taskService.addGroupIdentityLink(taskId, ACCOUNTING_GROUP, IdentityLinkType.CANDIDATE); // then authRule.disableAuthorization(); IList <IdentityLink> linksForTask = taskService.getIdentityLinksForTask(taskId); authRule.disableAuthorization(); assertNotNull(linksForTask); assertEquals(1, linksForTask.Count); IdentityLink identityLink = linksForTask[0]; assertNotNull(identityLink); assertEquals(ACCOUNTING_GROUP, identityLink.GroupId); assertEquals(IdentityLinkType.CANDIDATE, identityLink.Type); verifyGroupAuthorization(ACCOUNTING_GROUP); }
// TaskService#addUserIdentityLink() /////////////////////////////////// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testStandaloneTaskAddUserIdentityLinkAndUserOwnerPermissions() public virtual void testStandaloneTaskAddUserIdentityLinkAndUserOwnerPermissions() { // given string taskId = "myTask"; createTask(taskId); authRule.createGrantAuthorization(TASK, taskId, userId, UPDATE); // when taskService.addUserIdentityLink(taskId, DEMO, IdentityLinkType.CANDIDATE); // then authRule.disableAuthorization(); IList <IdentityLink> linksForTask = taskService.getIdentityLinksForTask(taskId); authRule.disableAuthorization(); assertNotNull(linksForTask); assertEquals(1, linksForTask.Count); IdentityLink identityLink = linksForTask[0]; assertNotNull(identityLink); assertEquals(DEMO, identityLink.UserId); assertEquals(IdentityLinkType.CANDIDATE, identityLink.Type); verifyUserAuthorization(DEMO); taskService.deleteTask(taskId, true); }
// TaskService#addGroupIdentityLink() /////////////////////////////////// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testStandaloneTaskAddGroupIdentityLink() public virtual void testStandaloneTaskAddGroupIdentityLink() { // given string taskId = "myTask"; createTask(taskId); authRule.createGrantAuthorization(TASK, taskId, userId, UPDATE); // when taskService.addGroupIdentityLink(taskId, ACCOUNTING_GROUP, IdentityLinkType.CANDIDATE); // then authRule.disableAuthorization(); IList <IdentityLink> linksForTask = taskService.getIdentityLinksForTask(taskId); authRule.disableAuthorization(); assertNotNull(linksForTask); assertEquals(1, linksForTask.Count); IdentityLink identityLink = linksForTask[0]; assertNotNull(identityLink); assertEquals(ACCOUNTING_GROUP, identityLink.GroupId); assertEquals(IdentityLinkType.CANDIDATE, identityLink.Type); verifyGroupAuthorization(ACCOUNTING_GROUP); taskService.deleteTask(taskId, true); }
public virtual void testCandidateGroupLink() { try { identityService.AuthenticatedUserId = "demo"; runtimeService.startProcessInstanceByKey("IdentityLinksProcess"); string taskId = taskService.createTaskQuery().singleResult().Id; taskService.addCandidateGroup(taskId, "muppets"); IList <IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId); IdentityLink identityLink = identityLinks[0]; assertEquals("muppets", identityLink.GroupId); assertNull("kermit", identityLink.UserId); assertEquals(IdentityLinkType.CANDIDATE, identityLink.Type); assertEquals(taskId, identityLink.TaskId); assertEquals(1, identityLinks.Count); if (processEngineConfiguration.HistoryLevel.Id >= ProcessEngineConfigurationImpl.HISTORYLEVEL_FULL) { IList <Event> taskEvents = taskService.getTaskEvents(taskId); assertEquals(1, taskEvents.Count); Event taskEvent = taskEvents[0]; assertEquals(org.camunda.bpm.engine.task.Event_Fields.ACTION_ADD_GROUP_LINK, taskEvent.Action); IList <string> taskEventMessageParts = taskEvent.MessageParts; assertEquals("muppets", taskEventMessageParts[0]); assertEquals(IdentityLinkType.CANDIDATE, taskEventMessageParts[1]); assertEquals(2, taskEventMessageParts.Count); } taskService.deleteCandidateGroup(taskId, "muppets"); if (processEngineConfiguration.HistoryLevel.Id >= ProcessEngineConfigurationImpl.HISTORYLEVEL_FULL) { IList <Event> taskEvents = taskService.getTaskEvents(taskId); Event taskEvent = findTaskEvent(taskEvents, org.camunda.bpm.engine.task.Event_Fields.ACTION_DELETE_GROUP_LINK); assertEquals(org.camunda.bpm.engine.task.Event_Fields.ACTION_DELETE_GROUP_LINK, taskEvent.Action); IList <string> taskEventMessageParts = taskEvent.MessageParts; assertEquals("muppets", taskEventMessageParts[0]); assertEquals(IdentityLinkType.CANDIDATE, taskEventMessageParts[1]); assertEquals(2, taskEventMessageParts.Count); assertEquals(2, taskEvents.Count); } assertEquals(0, taskService.getIdentityLinksForTask(taskId).Count); } finally { identityService.clearAuthentication(); } }
public OpBuddy AddBuddy(string link) { IdentityLink ident = IdentityLink.Decode(link); if (!Utilities.MemCompare(ident.PublicOpID, Core.User.Settings.PublicOpID)) { throw new Exception("This buddy link is not for " + Core.User.Settings.Operation); } return(AddBuddy(ident.Name, ident.PublicKey)); }
public void TestIdentityLink1() { IdentityLink data = new IdentityLink(); data.Group = "group"; data.IdentityLinkId = Guid.NewGuid().ToString(); data.ProcessInstanceId = Guid.NewGuid().ToString(); data.ProcessTaskId = Guid.NewGuid().ToString(); data.Type = EIdentityLinkType.Owner; data.Username = "******"; Assert.IsNotNull(data.Group); Assert.IsNotNull(data.IdentityLinkId); Assert.IsNotNull(data.ProcessInstanceId); Assert.IsNotNull(data.ProcessTaskId); Assert.IsNotNull(data.Type); Assert.IsNotNull(data.Username); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPropagateTenantIdToCandidateStarterUser() public virtual void shouldPropagateTenantIdToCandidateStarterUser() { // when DeploymentBuilder builder = repositoryService.createDeployment().addClasspathResource(CANDIDATE_STARTER_USER).tenantId(TENANT_ONE); testRule.deploy(builder); // then ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); IList <IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.Id); assertEquals(1, links.Count); IdentityLink link = links[0]; assertNotNull(link.TenantId); assertEquals(TENANT_ONE, link.TenantId); }
private bool PreProcessLink(string arg) { try { arg = arg.TrimEnd('/'); // copy so modifications arent permanent if (arg.Contains("/file/")) { FileLink link = FileLink.Decode(arg, null); var ui = FindCoreUI(link.PublicOpID); if (ui != null) { ShareService share = ui.Core.GetService(DeOps.Services.ServiceIDs.Share) as ShareService; share.DownloadLink(arg); if (ui.GuiMain != null && !ui.GuiMain.ShowExistingView(typeof(SharingView))) { ui.ShowView(new SharingView(ui.Core, ui.Core.UserID), true); } return(true); } } else if (arg.Contains("/ident/")) { IdentityLink link = IdentityLink.Decode(arg); var target = FindCoreUI(link.PublicOpID); if (target != null) { BuddyView.AddBuddyDialog(target.Core, arg); return(true); } } } catch { } return(false); }
public virtual void testOwnerLink() { Task task = taskService.newTask("task"); task.Owner = "owner"; taskService.saveTask(task); IList <IdentityLink> identityLinks = taskService.getIdentityLinksForTask(task.Id); assertNotNull(identityLinks); assertEquals(1, identityLinks.Count); IdentityLink identityLink = identityLinks[0]; assertEquals(IdentityLinkType.OWNER, identityLink.Type); assertEquals("owner", identityLink.UserId); assertEquals("task", identityLink.TaskId); taskService.deleteTask(task.Id, true); }
public virtual void testAssigneeLink() { Task task = taskService.newTask("task"); task.Assignee = "assignee"; taskService.saveTask(task); IList <IdentityLink> identityLinks = taskService.getIdentityLinksForTask(task.Id); assertNotNull(identityLinks); assertEquals(1, identityLinks.Count); IdentityLink identityLink = identityLinks[0]; assertEquals(IdentityLinkType.ASSIGNEE, identityLink.Type); assertEquals("assignee", identityLink.UserId); assertEquals("task", identityLink.TaskId); taskService.deleteTask(task.Id, true); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testIdentityLinkCaching() public virtual void testIdentityLinkCaching() { string[] taskIds = new string[] { "test" }; // mock identityLinks and query IdentityLink link1 = mock(typeof(IdentityLink)); when(link1.TaskId).thenReturn(taskIds[0]); IdentityLink link2 = mock(typeof(IdentityLink)); when(link2.TaskId).thenReturn(taskIds[0]); when(processEngine.TaskService.getIdentityLinksForTask(anyString())).thenReturn(Arrays.asList(link1, link2)); // configure cache HalRelationCacheConfiguration configuration = new HalRelationCacheConfiguration(); configuration.CacheImplementationClass = typeof(DefaultHalResourceCache); IDictionary <string, object> halIdentityLinkConfig = new Dictionary <string, object>(); halIdentityLinkConfig["capacity"] = 100; halIdentityLinkConfig["secondsToLive"] = 10000; configuration.addCacheConfiguration(typeof(HalIdentityLink), halIdentityLinkConfig); contextListener.configureCaches(configuration); // cache exists and is empty DefaultHalResourceCache cache = (DefaultHalResourceCache)Hal.Instance.getHalRelationCache(typeof(HalIdentityLink)); assertNotNull(cache); assertEquals(0, cache.size()); // get link resolver and resolve identity link HalLinkResolver linkResolver = Hal.Instance.getLinkResolver(typeof(IdentityRestService)); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<org.camunda.bpm.engine.rest.hal.HalResource<?>> halIdentityLinks = linkResolver.resolveLinks(taskIds, processEngine); IList <HalResource <object> > halIdentityLinks = linkResolver.resolveLinks(taskIds, processEngine); assertEquals(2, halIdentityLinks.Count); assertEquals(1, cache.size()); assertEquals(halIdentityLinks, cache.get(taskIds[0])); }
public virtual void testCandidateUserLink() { runtimeService.startProcessInstanceByKey("IdentityLinksProcess"); string taskId = taskService.createTaskQuery().singleResult().Id; taskService.addCandidateUser(taskId, "kermit"); IList <IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId); IdentityLink identityLink = identityLinks[0]; assertNull(identityLink.GroupId); assertEquals("kermit", identityLink.UserId); assertEquals(IdentityLinkType.CANDIDATE, identityLink.Type); assertEquals(taskId, identityLink.TaskId); assertEquals(1, identityLinks.Count); taskService.deleteCandidateUser(taskId, "kermit"); assertEquals(0, taskService.getIdentityLinksForTask(taskId).Count); }
public virtual void testCustomLinkGroupLink() { runtimeService.startProcessInstanceByKey("IdentityLinksProcess"); string taskId = taskService.createTaskQuery().singleResult().Id; taskService.addGroupIdentityLink(taskId, "muppets", "playing"); IList <IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId); IdentityLink identityLink = identityLinks[0]; assertEquals("muppets", identityLink.GroupId); assertNull("kermit", identityLink.UserId); assertEquals("playing", identityLink.Type); assertEquals(taskId, identityLink.TaskId); assertEquals(1, identityLinks.Count); taskService.deleteGroupIdentityLink(taskId, "muppets", "playing"); assertEquals(0, taskService.getIdentityLinksForTask(taskId).Count); }
[Fact] public async Task Execute() { //var user = await this.identityManager.FindUserByNameAsync("felix"); //var group = await this.identityManager.FindGroupByNameAsync("tests"); var identityLinks = new IdentityLink[] { new IdentityLink() { UserId = "test", Type = "starter" }, new IdentityLink() { GroupId = "tests", Type = "tests" } }; var procDefId = 1; //add await this.deploymentManager.AddIdentityLinksAsync(procDefId, identityLinks); var items = await this.deploymentManager.GetIdentityLinksAsync(procDefId); Assert.True(items.Count >= identityLinks.Length); //Remove var array = items.Select(x => x.Id).ToArray(); await this.deploymentManager.RemoveIdentityLinksAsync(array); items = await this.deploymentManager.GetIdentityLinksAsync(procDefId); Assert.True(items.Count == 0); this.Commit(); }