Search in sources :

Example 11 with UserProfile

use of org.ovirt.engine.core.common.businessentities.UserProfile in project ovirt-engine by oVirt.

the class UserProfileDaoTest method testGetByUserId.

/**
 * Ensures that retrieving an user profile by user id works as expected.
 */
@Test
public void testGetByUserId() {
    UserProfile result = dao.getByUserId(existingProfile.getUserId());
    assertNotNull(result);
    assertEquals(existingProfile, result);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) Test(org.junit.Test)

Example 12 with UserProfile

use of org.ovirt.engine.core.common.businessentities.UserProfile in project ovirt-engine by oVirt.

the class UserProfileDaoTest method testRemove.

/**
 * Ensures that removing user profiles works as expected.
 */
@Test
public void testRemove() {
    dao.remove(deletableProfile.getId());
    UserProfile result = dao.get(deletableProfile.getId());
    assertNull(result);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) Test(org.junit.Test)

Example 13 with UserProfile

use of org.ovirt.engine.core.common.businessentities.UserProfile in project ovirt-engine by oVirt.

the class UpdateUserProfileCommand method executeCommand.

@Override
protected void executeCommand() {
    UserProfile profile = getUserProfile();
    executeCommandUpdateSSHPublicKey(profile);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile)

Example 14 with UserProfile

use of org.ovirt.engine.core.common.businessentities.UserProfile in project ovirt-engine by oVirt.

the class UserProfilesOperationCommandBase method executeCommandUpdateSSHPublicKey.

protected void executeCommandUpdateSSHPublicKey(UserProfile existingProfile) {
    UserProfile newProfile = getParameters().getUserProfile();
    existingProfile.setSshPublicKey(newProfile.getSshPublicKey());
    /* backend must make sure that the ID changes each time the key content changes */
    existingProfile.setSshPublicKeyId(Guid.newGuid());
    userProfileDao.update(existingProfile);
    setSucceeded(true);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile)

Example 15 with UserProfile

use of org.ovirt.engine.core.common.businessentities.UserProfile in project ovirt-engine by oVirt.

the class AddUserProfileCommand method setActionMessageParameters.

@Override
protected void setActionMessageParameters() {
    UserProfile existingProfile = getUserProfile();
    if (existingProfile != null && isSSHPublicKeyUpdate(existingProfile)) {
        addValidationMessage(EngineMessage.VAR__ACTION__UPDATE);
    } else {
        addValidationMessage(EngineMessage.VAR__ACTION__ADD);
    }
    addValidationMessage(EngineMessage.VAR__TYPE__USER_PROFILE);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile)

Aggregations

UserProfile (org.ovirt.engine.core.common.businessentities.UserProfile)16 Test (org.junit.Test)6 UserProfileParameters (org.ovirt.engine.core.common.action.UserProfileParameters)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Before (org.junit.Before)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 Guid (org.ovirt.engine.core.compat.Guid)1 Frontend (org.ovirt.engine.ui.frontend.Frontend)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)1 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)1 UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)1