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);
}
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);
}
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);
}
Aggregations