Search in sources :

Example 1 with UserProfile

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

the class OptionsModel method onEdit.

private void onEdit() {
    if (getWindow() != null) {
        return;
    }
    final EditOptionsModel model = new EditOptionsModel();
    model.setTitle(constants.editOptionsTitle());
    // $NON-NLS-1$
    model.setHashName("edit_options");
    setWindow(model);
    UICommand okCommand = UICommand.createDefaultOkUiCommand(constants.ok(), this);
    model.getCommands().add(okCommand);
    UICommand cancelCommand = UICommand.createCancelUiCommand(constants.cancel(), this);
    model.getCommands().add(cancelCommand);
    AsyncDataProvider.getInstance().getUserProfile(model.asyncQuery(returnValue -> {
        UserProfile profile = returnValue.getReturnValue();
        if (profile != null) {
            setUserProfile(profile);
            model.getPublicKey().setEntity(profile.getSshPublicKey());
        }
    }));
}
Also used : UserProfileParameters(org.ovirt.engine.core.common.action.UserProfileParameters) UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 2 with UserProfile

use of org.ovirt.engine.core.common.businessentities.UserProfile 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 3 with UserProfile

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

the class RemoveUserProfileCommand method executeCommand.

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

Example 4 with UserProfile

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

the class VMConsoleProxyServlet method availablePublicKeys.

// TODO: implmement key filtering based on input parameters
private List<Map<String, String>> availablePublicKeys(String keyFingerPrint, String keyType, String keyContent) {
    List<Map<String, String>> jsonUsers = new ArrayList<>();
    QueryParametersBase userProfileParams = new QueryParametersBase();
    QueryReturnValue v = backend.runInternalQuery(QueryType.GetAllUserProfiles, userProfileParams);
    if (v != null) {
        List<UserProfile> profiles = v.getReturnValue();
        for (UserProfile profile : profiles) {
            if (StringUtils.isNotEmpty(profile.getSshPublicKey())) {
                for (String publicKey : StringUtils.split(profile.getSshPublicKey(), "\n")) {
                    if (StringUtils.isNotEmpty(publicKey)) {
                        Map<String, String> jsonUser = new HashMap<>();
                        jsonUser.put("entityid", profile.getUserId().toString());
                        jsonUser.put("entity", profile.getLoginName());
                        jsonUser.put("key", publicKey.trim());
                        jsonUsers.add(jsonUser);
                    }
                }
            }
        }
    }
    return jsonUsers;
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) QueryParametersBase(org.ovirt.engine.core.common.queries.QueryParametersBase) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with UserProfile

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

the class UserProfileDaoTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    dao = dbFacade.getUserProfileDao();
    existingProfile = dao.get(new Guid("38cb5663-96bc-485c-834a-cbbc03acc820"));
    deletableProfile = dao.get(new Guid("38cb5663-96bc-485c-834a-cbbc03acc821"));
    newProfile = new UserProfile();
    newProfile.setId(Guid.newGuid());
    newProfile.setUserId(new Guid("81940459-2ec4-4afa-bbaa-22549555293c"));
    newProfile.setSshPublicKeyId(new Guid("67bc5484-d4eb-47ce-8b6a-e9624b70b676"));
    newProfile.setSshPublicKey("key3");
    newProfile.setLoginName("userportal4@testportal.redhat.com@testportal.redhat.com");
// FIXME: this user@domain@domain is ugly, but it is harmless for our test.
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) Guid(org.ovirt.engine.core.compat.Guid) Before(org.junit.Before)

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