Search in sources :

Example 1 with GetDirectoryUserByPrincipalParameters

use of org.ovirt.engine.core.common.queries.GetDirectoryUserByPrincipalParameters in project ovirt-engine by oVirt.

the class BackendUsersResource method findDirectoryUser.

/**
 * Find the directory user that corresponds to the given model.
 *
 * @param directoryName the name of the directory where to perform the search
 * @param user the user model
 * @return the requested directory group or {@code null} if no such group exists
 */
private DirectoryUser findDirectoryUser(String directoryName, User user) {
    DirectoryUser result = null;
    String namespace = user.getNamespace();
    if (user.isSetDomainEntryId()) {
        result = getUserById(directoryName, namespace, user.getDomainEntryId());
    } else if (user.isSetId()) {
        result = getUserById(directoryName, namespace, user.getId());
    } else if (user.isSetPrincipal()) {
        result = getEntity(DirectoryUser.class, QueryType.GetDirectoryUserByPrincipal, new GetDirectoryUserByPrincipalParameters(directoryName, user.getPrincipal()), user.getPrincipal());
    } else if (user.isSetUserName()) {
        result = getEntity(DirectoryUser.class, SearchType.DirectoryUser, getDirectoryUserSearchPattern(AuthzUtils.getEntityNameWithoutAuthz(user.getUserName(), directoryName), user.getNamespace(), directoryName));
    }
    return result;
}
Also used : DirectoryUser(org.ovirt.engine.core.aaa.DirectoryUser) GetDirectoryUserByPrincipalParameters(org.ovirt.engine.core.common.queries.GetDirectoryUserByPrincipalParameters)

Aggregations

DirectoryUser (org.ovirt.engine.core.aaa.DirectoryUser)1 GetDirectoryUserByPrincipalParameters (org.ovirt.engine.core.common.queries.GetDirectoryUserByPrincipalParameters)1