Search in sources :

Example 41 with Permission

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

the class PermissionDaoTest method assertValidGetByAdElement.

/**
 * Asserts that the result of get for AD element is correct
 * @param result The result to check
 */
private static void assertValidGetByAdElement(List<Permission> result) {
    assertNotNull(result);
    assertFalse(result.isEmpty());
    for (Permission permission : result) {
        assertEquals(AD_ELEMENT_ID, permission.getAdElementId());
    }
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission)

Example 42 with Permission

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

the class PermissionDaoTest method testGetAllForRole.

/**
 * Ensures that a collection of permissions are returned.
 */
@Test
public void testGetAllForRole() {
    List<Permission> result = dao.getAllForRole(ROLE_ID);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    for (Permission permission : result) {
        assertEquals(ROLE_ID, permission.getRoleId());
    }
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) Test(org.junit.Test)

Example 43 with Permission

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

the class PermissionDaoTest method testGetAllForRoleAndAdElementAndObjectWithInvalidRole.

/**
 * Ensures that a null object is returned when the role is invalid.
 */
@Test
public void testGetAllForRoleAndAdElementAndObjectWithInvalidRole() {
    Permission result = dao.getForRoleAndAdElementAndObject(Guid.newGuid(), AD_ELEMENT_ID, VM_ENTITY_ID);
    assertNull(result);
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) Test(org.junit.Test)

Example 44 with Permission

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

the class PermissionDaoTest method testGetWithInvalidId.

/**
 * Ensures that getting a permission with a bad id fails.
 */
@Test
public void testGetWithInvalidId() {
    Permission result = dao.get(Guid.newGuid());
    assertNull(result);
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) Test(org.junit.Test)

Example 45 with Permission

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

the class PermissionDaoTest method testGetAllForRoleAndAdElementAndObjectWithInvalidObject.

/**
 * Ensures that a null object is returned when the object is invalid.
 */
@Test
public void testGetAllForRoleAndAdElementAndObjectWithInvalidObject() {
    Permission result = dao.getForRoleAndAdElementAndObject(ROLE_ID, AD_ELEMENT_ID, Guid.newGuid());
    assertNull(result);
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) Test(org.junit.Test)

Aggregations

Permission (org.ovirt.engine.core.common.businessentities.Permission)59 Test (org.junit.Test)14 ArrayList (java.util.ArrayList)12 Guid (org.ovirt.engine.core.compat.Guid)12 PermissionsOperationsParameters (org.ovirt.engine.core.common.action.PermissionsOperationsParameters)9 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)8 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)6 DbGroup (org.ovirt.engine.core.common.businessentities.aaa.DbGroup)6 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5 AdElementListModel (org.ovirt.engine.ui.uicommonweb.models.users.AdElementListModel)5 Role (org.ovirt.engine.core.common.businessentities.Role)4 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)3 QueryType (org.ovirt.engine.core.common.queries.QueryType)3 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)3 PermissionTypeColumn (org.ovirt.engine.ui.common.widget.table.column.PermissionTypeColumn)3 Frontend (org.ovirt.engine.ui.frontend.Frontend)3 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)3 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)3 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)3 Inject (com.google.inject.Inject)2