Search in sources :

Example 56 with DbUser

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

the class SessionDataContainerTest method setUpContainer.

@Before
public void setUpContainer() {
    when(engineSessionDao.remove(anyLong())).thenReturn(1);
    when(ssoSessionValidator.getSessionStatuses(any())).thenReturn(Collections.singletonMap(TEST_SSO_TOKEN, true));
    when(ssoSessionUtils.isSessionInUse(anyLong())).thenReturn(false);
    DbUser user = mock(DbUser.class);
    container.setUser(TEST_SESSION_ID, user);
    container.setSsoAccessToken(TEST_SESSION_ID, TEST_SSO_TOKEN);
}
Also used : DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Before(org.junit.Before)

Example 57 with DbUser

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

the class SessionDataContainerTest method testGetUserAndSetUserWithSessionParam.

@Test
public void testGetUserAndSetUserWithSessionParam() {
    DbUser user = mock(DbUser.class);
    container.setUser(TEST_SESSION_ID, user);
    assertEquals("Get should return the value with a given session", user, container.getUser(TEST_SESSION_ID, false));
    clearSession();
}
Also used : DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Test(org.junit.Test)

Example 58 with DbUser

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

the class ProcessOvfUpdateForStoragePoolCommandTest method initTestForPool.

private void initTestForPool(StoragePool pool, List<Guid> vmGuids, List<Guid> templatesGuids, List<Guid> removedGuids) {
    Guid poolId = pool.getId();
    doReturn(vmGuids).when(vmAndTemplatesGenerationsDao).getVmsIdsForOvfUpdate(poolId);
    doReturn(templatesGuids).when(vmAndTemplatesGenerationsDao).getVmTemplatesIdsForOvfUpdate(poolId);
    doReturn(removedGuids).when(vmAndTemplatesGenerationsDao).getIdsForOvfDeletion(poolId);
    doReturn(Collections.EMPTY_LIST).when(affinityGroupDao).getAllAffinityGroupsByVmId(any());
    doReturn(Collections.EMPTY_LIST).when(labelDao).getAllByEntityIds(any());
    doReturn(new DbUser()).when(dbUserDao).getByUsernameAndDomain(any(), any());
    doReturn(Collections.EMPTY_LIST).when(permissionDao).getAllForAdElementAndObjectId(any(), any());
    pool.setStatus(StoragePoolStatus.Up);
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser)

Example 59 with DbUser

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

the class BaseApplicationInit method performLogin.

protected void performLogin(T loginModel) {
    DbUser loggedUser = loginModel.getLoggedUser();
    beforeLogin();
    // UiCommon login preparation
    frontend.initLoggedInUser(loggedUser);
    // UI login actions
    user.login();
    afterLogin();
    // Perform initial GWTP place transition
    performPlaceTransition();
}
Also used : DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser)

Example 60 with DbUser

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

the class BaseApplicationInit method handleUserInfo.

/**
 * When a user is already logged in on the server, the server provides user data within the host page.
 */
protected void handleUserInfo(AutoLoginData userInfo) {
    final DbUser loggedUser = userInfo.getDbUser();
    // Use deferred command because CommonModel change needs to happen
    // after all model providers have been properly initialized
    Scheduler.get().scheduleDeferred(() -> {
        lockInteractionManager.showLoadingIndicator();
        getLoginModel().autoLogin(loggedUser);
    });
    user.setUserInfo(userInfo);
}
Also used : DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser)

Aggregations

DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)109 Test (org.junit.Test)26 ArrayList (java.util.ArrayList)18 Guid (org.ovirt.engine.core.compat.Guid)18 DbGroup (org.ovirt.engine.core.common.businessentities.aaa.DbGroup)13 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)10 HashSet (java.util.HashSet)9 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)9 HashMap (java.util.HashMap)8 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)8 Collection (java.util.Collection)7 Before (org.junit.Before)7 Permission (org.ovirt.engine.core.common.businessentities.Permission)7 List (java.util.List)5 Map (java.util.Map)5 AttachEntityToTagParameters (org.ovirt.engine.core.common.action.AttachEntityToTagParameters)5 PermissionsOperationsParameters (org.ovirt.engine.core.common.action.PermissionsOperationsParameters)5 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)5 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)5 TagListModel (org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel)5