Package com.sonatype.security.ldap.api.dto

Examples of com.sonatype.security.ldap.api.dto.LdapUserDTO


    for (LdapUserDTO user : userListResponse.getData()) {
      userMap.put(user.getUserId(), user);
    }

    // now check everybody
    LdapUserDTO cstamas = userMap.get("cstamas");
    Assert.assertEquals("Tamas Cservenak", cstamas.getName());
    Assert.assertEquals("cstamas@sonatype.com", cstamas.getEmail());
    Assert.assertEquals(2, cstamas.getRoles().size());
    Assert.assertTrue(cstamas.getRoles().contains("public"));
    Assert.assertTrue(cstamas.getRoles().contains("snapshots"));

    LdapUserDTO brianf = userMap.get("brianf");
    Assert.assertEquals("Brian Fox", brianf.getName());
    Assert.assertEquals("brianf@sonatype.com", brianf.getEmail());
    Assert.assertEquals(2, brianf.getRoles().size());
    Assert.assertTrue(brianf.getRoles().contains("public"));
    Assert.assertTrue(brianf.getRoles().contains("releases"));

    LdapUserDTO jvanzyl = userMap.get("jvanzyl");
    Assert.assertEquals("Jason Van Zyl", jvanzyl.getName());
    Assert.assertEquals("jvanzyl@sonatype.com", jvanzyl.getEmail());
    Assert.assertEquals(3, jvanzyl.getRoles().size());
    Assert.assertTrue(jvanzyl.getRoles().contains("public"));
    Assert.assertTrue(jvanzyl.getRoles().contains("snapshots"));
    Assert.assertTrue(jvanzyl.getRoles().contains("releases"));

  }
View Full Code Here


    }
    return result;
  }

  private LdapUserDTO toDto(LdapUser ldapUser) {
    LdapUserDTO dto;

    dto = new LdapUserDTO();

    // now set the rest of the props
    dto.setUserId(ldapUser.getUsername());
    dto.setEmail(ldapUser.getEmail());
    dto.setName(ldapUser.getRealName());

    // add the roles
    for (String role : (Set<String>) ldapUser.getMembership()) {
      dto.addRole(role);
    }
    return dto;
  }
View Full Code Here

TOP

Related Classes of com.sonatype.security.ldap.api.dto.LdapUserDTO

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.