use of com.cloud.api.response.LdapUserResponse in project cosmic by MissionCriticalCloud.
the class LdapImportUsersCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
List<LdapUser> users;
try {
if (StringUtils.isNotBlank(groupName)) {
users = _ldapManager.getUsersInGroup(groupName);
} else {
users = _ldapManager.getUsers();
}
} catch (final NoLdapUserMatchingQueryException ex) {
users = new ArrayList<>();
s_logger.info("No Ldap user matching query. " + " ::: " + ex.getMessage());
}
final List<LdapUser> addedUsers = new ArrayList<>();
for (final LdapUser user : users) {
final Domain domain = getDomain(user);
try {
createCloudstackUserAccount(user, getAccountName(user), domain);
addedUsers.add(user);
} catch (final InvalidParameterValueException ex) {
s_logger.error("Failed to create user with username: " + user.getUsername() + " ::: " + ex.getMessage());
}
}
final ListResponse<LdapUserResponse> response = new ListResponse<>();
response.setResponses(createLdapUserResponse(addedUsers));
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of com.cloud.api.response.LdapUserResponse in project cosmic by MissionCriticalCloud.
the class LdapUserSearchCmd method createLdapUserResponse.
private List<LdapUserResponse> createLdapUserResponse(final List<LdapUser> users) {
final List<LdapUserResponse> ldapUserResponses = new ArrayList<>();
if (users != null) {
for (final LdapUser user : users) {
final LdapUserResponse ldapUserResponse = _ldapManager.createLdapUserResponse(user);
ldapUserResponse.setObjectName("LdapUser");
ldapUserResponses.add(ldapUserResponse);
}
}
return ldapUserResponses;
}
use of com.cloud.api.response.LdapUserResponse in project cosmic by MissionCriticalCloud.
the class LdapImportUsersCmd method createLdapUserResponse.
private List<LdapUserResponse> createLdapUserResponse(final List<LdapUser> users) {
final List<LdapUserResponse> ldapResponses = new ArrayList<>();
for (final LdapUser user : users) {
final LdapUserResponse ldapResponse = _ldapManager.createLdapUserResponse(user);
ldapResponse.setObjectName("LdapUser");
ldapResponses.add(ldapResponse);
}
return ldapResponses;
}
use of com.cloud.api.response.LdapUserResponse in project cosmic by MissionCriticalCloud.
the class LdapListUsersCmd method createLdapUserResponse.
private List<LdapUserResponse> createLdapUserResponse(final List<LdapUser> users) {
final List<LdapUserResponse> ldapResponses = new ArrayList<>();
for (final LdapUser user : users) {
if (getListType().equals("all") || !isACloudstackUser(user)) {
final LdapUserResponse ldapResponse = _ldapManager.createLdapUserResponse(user);
ldapResponse.setObjectName("LdapUser");
ldapResponses.add(ldapResponse);
}
}
return ldapResponses;
}
use of com.cloud.api.response.LdapUserResponse in project cosmic by MissionCriticalCloud.
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