use of org.apache.cloudstack.api.response.LdapUserResponse in project cloudstack by apache.
the class LdapListUsersCmd method filterLocalDomain.
/**
* filter the list of ldap users. no users visible to the caller already in the domain specified should be in the returned list
* @param input ldap response list of users
* @return a list of ldap users not already in ACS
*/
public List<LdapUserResponse> filterLocalDomain(List<LdapUserResponse> input) {
if (s_logger.isTraceEnabled()) {
s_logger.trace("filtering local domain users");
}
final List<LdapUserResponse> ldapResponses = new ArrayList<LdapUserResponse>();
String domainId = getCurrentDomainId();
for (final LdapUserResponse user : input) {
UserResponse cloudstackUser = getCloudstackUser(user);
if (cloudstackUser == null || /*doesn't exist in cloudstack*/
!domainId.equals(cloudstackUser.getDomainId()) || /* doesn't exist in this domain */
!cloudstackUser.getUserSource().equalsIgnoreCase(User.Source.LDAP.toString())) /* is from another source */
{
ldapResponses.add(user);
}
}
annotateUserListWithSources(ldapResponses);
return ldapResponses;
}
use of org.apache.cloudstack.api.response.LdapUserResponse in project cloudstack by apache.
the class LdapManagerImpl method createLdapUserResponse.
@Override
public LdapUserResponse createLdapUserResponse(final LdapUser user) {
final LdapUserResponse response = new LdapUserResponse();
response.setUsername(user.getUsername());
response.setFirstname(user.getFirstname());
response.setLastname(user.getLastname());
response.setEmail(user.getEmail());
response.setPrincipal(user.getPrincipal());
response.setDomain(user.getDomain());
return response;
}
Aggregations