Search in sources :

Example 21 with Permission

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

the class PermissionsCommandBase method getAuthz.

public String getAuthz() {
    initUserAndGroupData();
    Permission perms = getParameters().getPermission();
    return StringUtils.isNotEmpty(perms.getAuthz()) ? perms.getAuthz() : dbUser == null ? dbGroup == null ? "" : dbGroup.getDomain() : dbUser.getDomain();
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission)

Example 22 with Permission

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

the class PermissionDaoTest method testGetAllForAdElementAndObject.

/**
 * Ensures that the correct collection is returned.
 */
@Test
public void testGetAllForAdElementAndObject() {
    List<Permission> result = dao.getAllForAdElementAndObjectId(AD_ELEMENT_ID, VM_ENTITY_ID);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    for (Permission permission : result) {
        assertEquals(AD_ELEMENT_ID, permission.getAdElementId());
        assertEquals(VM_ENTITY_ID, permission.getObjectId());
    }
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) Test(org.junit.Test)

Example 23 with Permission

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

the class PermissionDaoTest method testGetAllForRoleAndObject.

/**
 * Ensures that the correct collection is returned.
 */
@Test
public void testGetAllForRoleAndObject() {
    List<Permission> result = dao.getAllForRoleAndObject(ROLE_ID, VM_ENTITY_ID);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    for (Permission permission : result) {
        assertEquals(ROLE_ID, permission.getRoleId());
        assertEquals(VM_ENTITY_ID, permission.getObjectId());
    }
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) Test(org.junit.Test)

Example 24 with Permission

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

the class PermissionDaoTest method testSave.

/**
 * Ensures that saving a permission works as expected.
 */
@Test
public void testSave() {
    dao.save(new_permissions);
    Permission result = dao.getForRoleAndAdElementAndObject(new_permissions.getRoleId(), new_permissions.getAdElementId(), new_permissions.getObjectId());
    assertNotNull(result);
    assertEquals(new_permissions, result);
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) Test(org.junit.Test)

Example 25 with Permission

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

the class PermissionDaoTest method testRemove.

/**
 * Ensures that remove works as expected.
 */
@Test
public void testRemove() {
    dao.remove(EXISTING_PERMISSION_ID);
    Permission result = dao.get(EXISTING_PERMISSION_ID);
    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