Search in sources :

Example 1 with UserProfileParameters

use of org.ovirt.engine.core.common.action.UserProfileParameters in project ovirt-engine by oVirt.

the class BackendSSHPublicKeysResource method add.

@Override
public Response add(SshPublicKey pubkey) {
    validateParameters(pubkey, "content");
    UserProfileParameters params = new UserProfileParameters();
    UserProfile profile = map(pubkey);
    profile.setUserId(userId);
    params.setUserProfile(profile);
    return performAction(ActionType.AddUserProfile, params);
}
Also used : UserProfileParameters(org.ovirt.engine.core.common.action.UserProfileParameters) UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile)

Example 2 with UserProfileParameters

use of org.ovirt.engine.core.common.action.UserProfileParameters in project ovirt-engine by oVirt.

the class OptionsModel method onSave.

private void onSave() {
    EditOptionsModel model = (EditOptionsModel) getWindow();
    UserProfileParameters params = new UserProfileParameters();
    ActionType action = ActionType.AddUserProfile;
    if (getUserProfile() != null) {
        action = ActionType.UpdateUserProfile;
        params.setUserProfile(getUserProfile());
    }
    params.getUserProfile().setSshPublicKey(model.getPublicKey().getEntity());
    model.startProgress(null);
    Frontend.getInstance().runAction(action, params, result -> {
        EditOptionsModel editOptionsModel = (EditOptionsModel) result.getState();
        editOptionsModel.stopProgress();
        cancel();
    }, model);
}
Also used : UserProfileParameters(org.ovirt.engine.core.common.action.UserProfileParameters) ActionType(org.ovirt.engine.core.common.action.ActionType)

Example 3 with UserProfileParameters

use of org.ovirt.engine.core.common.action.UserProfileParameters in project ovirt-engine by oVirt.

the class BackendSSHPublicKeyResource method remove.

@Override
public Response remove() {
    // we cannot just remove UserProfile, because we'll wipe out unrelated fields.
    // Instead, we just clear the public key fields.
    UserProfile entity = getEntity(UserProfile.class, QueryType.GetUserProfile, new IdQueryParameters(userId), userId.toString(), true);
    entity.setSshPublicKeyId(Guid.Empty);
    entity.setSshPublicKey("");
    UserProfileParameters parameters = new UserProfileParameters();
    parameters.setUserProfile(entity);
    return performAction(ActionType.UpdateUserProfile, parameters);
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) UserProfileParameters(org.ovirt.engine.core.common.action.UserProfileParameters) UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile)

Aggregations

UserProfileParameters (org.ovirt.engine.core.common.action.UserProfileParameters)3 UserProfile (org.ovirt.engine.core.common.businessentities.UserProfile)2 ActionType (org.ovirt.engine.core.common.action.ActionType)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1