Package org.activiti.engine.identity

Examples of org.activiti.engine.identity.Group


    identityService.deleteUser("johndoe");
  }

  public void testGroup() {
    Group group = identityService.newGroup("sales");
    group.setName("Sales division");
    identityService.saveGroup(group);

    group = identityService.createGroupQuery().groupId("sales").singleResult();
    assertEquals("sales", group.getId());
    assertEquals("Sales division", group.getName());

    identityService.deleteGroup("sales");
  }
View Full Code Here


    identityService.deleteGroup("sales");
  }

  public void testMembership() {
    Group sales = identityService.newGroup("sales");
    identityService.saveGroup(sales);

    Group development = identityService.newGroup("development");
    identityService.saveGroup(development);

    User johndoe = identityService.newUser("johndoe");
    identityService.saveUser(johndoe);
View Full Code Here

    }
  }
 
  protected void createGroup(String groupId, String type) {
    if (identityService.createGroupQuery().groupId(groupId).count() == 0) {
      Group newGroup = identityService.newGroup(groupId);
      newGroup.setName(groupId.substring(0, 1).toUpperCase() + groupId.substring(1));
      newGroup.setType(type);
      identityService.saveGroup(newGroup);
    }
  }
View Full Code Here

    }
  }
 
  protected void createGroup(String groupId, String type) {
    if (identityService.createGroupQuery().groupId(groupId).count() == 0) {
      Group newGroup = identityService.newGroup(groupId);
      newGroup.setName(groupId.substring(0, 1).toUpperCase() + groupId.substring(1));
      newGroup.setType(type);
      identityService.saveGroup(newGroup);
    }
  }
View Full Code Here

  private static final String GONZO = "gonzo";

  public void setUp() throws Exception {
    super.setUp();
   
    Group accountants = identityService.newGroup("accountancy");
    identityService.saveGroup(accountants);
    Group managers = identityService.newGroup("management");
    identityService.saveGroup(managers);
    Group sales = identityService.newGroup("sales");
    identityService.saveGroup(sales);

    User kermit = identityService.newUser(KERMIT);
    identityService.saveUser(kermit);
    identityService.createMembership(KERMIT, "accountancy");
View Full Code Here

            @Override
            public void run(String... strings) throws Exception {


                // install groups & users
                Group group = identityService.newGroup("user");
                group.setName("users");
                group.setType("security-role");
                identityService.saveGroup(group);

                User joram = identityService.newUser("jbarrez");
                joram.setFirstName("Joram");
                joram.setLastName("Barrez");
View Full Code Here

            identityService.saveUser(u);
            return u;
        }

        protected Group group(String groupName) {
            Group group = identityService.newGroup(groupName);
            group.setName(groupName);
            group.setType("security-role");
            identityService.saveGroup(group);
            return group;
        }
View Full Code Here

            return new InitializingBean() {
                @Override
                public void afterPropertiesSet() throws Exception {

                    // install groups & users
                    Group userGroup = group("user");
                    Group adminGroup = group("admin");

                    User joram = user("jbarrez", "Joram", "Barrez");
                    identityService.createMembership(joram.getId(), userGroup.getId());
                    identityService.createMembership(joram.getId(), adminGroup.getId());

                    User josh = user("jlong", "Josh", "Long");
                    identityService.createMembership(josh.getId(), userGroup.getId());
                }
            };
View Full Code Here

        return new CommandLineRunner() {
            @Override
            public void run(String... strings) throws Exception {

                // install groups & users
                Group group = identityService.newGroup("user");
                group.setName("users");
                group.setType("security-role");
                identityService.saveGroup(group);

                User joram = identityService.newUser("jbarrez");
                joram.setFirstName("Joram");
                joram.setLastName("Barrez");
View Full Code Here

*/
public class GroupMembershipResourceTest extends BaseSpringRestTestCase {

  public void testCreatemembership() throws Exception {
    try {
      Group testGroup = identityService.newGroup("testgroup");
      testGroup.setName("Test group");
      testGroup.setType("Test type");
      identityService.saveGroup(testGroup);
     
      User testUser = identityService.newUser("testuser");
      identityService.saveUser(testUser);
     
      ObjectNode requestNode = objectMapper.createObjectNode();
      requestNode.put("userId", "testuser");
     
      HttpPost httpPost = new HttpPost(SERVER_URL_PREFIX +
          RestUrls.createRelativeResourceUrl(RestUrls.URL_GROUP_MEMBERSHIP_COLLECTION, "testgroup"));
      httpPost.setEntity(new StringEntity(requestNode.toString()));
      CloseableHttpResponse response = executeRequest(httpPost, HttpStatus.SC_CREATED);
      JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
      closeResponse(response);
      assertNotNull(responseNode);
      assertEquals("testuser", responseNode.get("userId").textValue());
      assertEquals("testgroup", responseNode.get("groupId").textValue());
      assertTrue(responseNode.get("url").textValue().endsWith(RestUrls.createRelativeResourceUrl(
              RestUrls.URL_GROUP_MEMBERSHIP, testGroup.getId(), testUser.getId())));     
     
      Group createdGroup  = identityService.createGroupQuery().groupId("testgroup").singleResult();
      assertNotNull(createdGroup);
      assertEquals("Test group", createdGroup.getName());
      assertEquals("Test type", createdGroup.getType());
     
      assertNotNull(identityService.createUserQuery().memberOfGroup("testgroup").singleResult());
      assertEquals("testuser", identityService.createUserQuery().memberOfGroup("testgroup").singleResult().getId());
    } finally {
      try {
View Full Code Here

TOP

Related Classes of org.activiti.engine.identity.Group

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.