Search in sources :

Example 6 with DirectoryUser

use of org.ovirt.engine.core.aaa.DirectoryUser in project ovirt-engine by oVirt.

the class BackendUsersResource method getUserById.

private DirectoryUser getUserById(String directoryName, String namespace, String userId) {
    DirectoryUser result;
    try {
        userId = DirectoryEntryIdUtils.decode(userId);
    } catch (IllegalArgumentException exception) {
        return null;
    }
    result = getEntity(DirectoryUser.class, QueryType.GetDirectoryUserById, new DirectoryIdQueryParameters(directoryName, namespace, userId), userId, true);
    return result;
}
Also used : DirectoryUser(org.ovirt.engine.core.aaa.DirectoryUser) DirectoryIdQueryParameters(org.ovirt.engine.core.common.queries.DirectoryIdQueryParameters)

Example 7 with DirectoryUser

use of org.ovirt.engine.core.aaa.DirectoryUser in project ovirt-engine by oVirt.

the class AdElementListModel method addUsersToModel.

protected void addUsersToModel(QueryReturnValue returnValue, Set<String> excludeUsers) {
    for (Queryable item : (List<Queryable>) returnValue.getReturnValue()) {
        DirectoryUser a = (DirectoryUser) item;
        if (!excludeUsers.contains(a.getId())) {
            EntityModel<DbUser> tempVar2 = new EntityModel<>();
            tempVar2.setEntity(new DbUser(a));
            getusers().add(tempVar2);
        }
    }
}
Also used : DirectoryUser(org.ovirt.engine.core.aaa.DirectoryUser) Queryable(org.ovirt.engine.core.common.businessentities.Queryable) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) List(java.util.List) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser)

Example 8 with DirectoryUser

use of org.ovirt.engine.core.aaa.DirectoryUser in project ovirt-engine by oVirt.

the class DirectoryUtils method mapPrincipalRecordToDirectoryUser.

public DirectoryUser mapPrincipalRecordToDirectoryUser(final String authzName, final ExtMap principalRecord) {
    DirectoryUser directoryUser = null;
    if (principalRecord != null) {
        directoryUser = new DirectoryUser(authzName, principalRecord.get(Authz.PrincipalRecord.NAMESPACE), principalRecord.get(Authz.PrincipalRecord.ID), principalRecord.get(Authz.PrincipalRecord.NAME), principalRecord.get(Authz.PrincipalRecord.PRINCIPAL), principalRecord.get(Authz.PrincipalRecord.DISPLAY_NAME));
        directoryUser.setDepartment(principalRecord.get(Authz.PrincipalRecord.DEPARTMENT));
        directoryUser.setFirstName(principalRecord.get(Authz.PrincipalRecord.FIRST_NAME));
        directoryUser.setLastName(principalRecord.get(Authz.PrincipalRecord.LAST_NAME));
        directoryUser.setEmail(principalRecord.get(Authz.PrincipalRecord.EMAIL));
        directoryUser.setTitle(principalRecord.get(Authz.PrincipalRecord.TITLE));
        directoryUser.setPrincipal(principalRecord.get(Authz.PrincipalRecord.PRINCIPAL));
        List<DirectoryGroup> directoryGroups = new ArrayList<>();
        Collection<ExtMap> groups = principalRecord.get(Authz.PrincipalRecord.GROUPS);
        if (groups != null) {
            for (ExtMap group : groups) {
                directoryGroups.add(mapGroupRecordToDirectoryGroup(authzName, group));
            }
        }
        directoryUser.setGroups(directoryGroups);
    }
    return directoryUser;
}
Also used : DirectoryUser(org.ovirt.engine.core.aaa.DirectoryUser) ExtMap(org.ovirt.engine.api.extensions.ExtMap) DirectoryGroup(org.ovirt.engine.core.aaa.DirectoryGroup) ArrayList(java.util.ArrayList)

Aggregations

DirectoryUser (org.ovirt.engine.core.aaa.DirectoryUser)8 ArrayList (java.util.ArrayList)3 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)3 ExtMap (org.ovirt.engine.api.extensions.ExtMap)2 User (org.ovirt.engine.api.model.User)2 DirectoryGroup (org.ovirt.engine.core.aaa.DirectoryGroup)2 Collection (java.util.Collection)1 List (java.util.List)1 Domain (org.ovirt.engine.api.model.Domain)1 Group (org.ovirt.engine.api.model.Group)1 Groups (org.ovirt.engine.api.model.Groups)1 Users (org.ovirt.engine.api.model.Users)1 QueryData (org.ovirt.engine.core.aaa.QueryData)1 AddUserParameters (org.ovirt.engine.core.common.action.AddUserParameters)1 Queryable (org.ovirt.engine.core.common.businessentities.Queryable)1 DirectoryIdQueryParameters (org.ovirt.engine.core.common.queries.DirectoryIdQueryParameters)1 GetDirectoryUserByPrincipalParameters (org.ovirt.engine.core.common.queries.GetDirectoryUserByPrincipalParameters)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1 Guid (org.ovirt.engine.core.compat.Guid)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1