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