use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class PermissionDaoTest method testGetAllForRoleAndAdElementAndObjectWithInvalidAdElement.
/**
* Ensures that a null object is returned when the element is invalid.
*/
@Test
public void testGetAllForRoleAndAdElementAndObjectWithInvalidAdElement() {
Permission result = dao.getForRoleAndAdElementAndObject(ROLE_ID, Guid.newGuid(), VM_ENTITY_ID);
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class PermissionDaoTest method assertGetTreeForEntityResult.
/**
* asserts the result of a call to {@link PermissionDao#getTreeForEntity(Guid, VdcObjectType)}
* @param entityID The object to retrieve tree for
* @param alternativeObjectIds Additional object IDs that are allowed in the resulting permissions
*/
protected void assertGetTreeForEntityResult(Guid entityID, List<Permission> result, Guid... alternativeObjectIds) {
Set<Guid> expectedObjectIds = new HashSet<>();
expectedObjectIds.add(entityID);
expectedObjectIds.addAll(Arrays.asList(alternativeObjectIds));
assertNotNull(result);
assertFalse(result.isEmpty());
for (Permission permission : result) {
assertTrue(expectedObjectIds.contains(permission.getObjectId()));
}
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class PermissionDaoTest method testGetAllForRoleAndAdElement.
/**
* Ensures a collection is returned.
*/
@Test
public void testGetAllForRoleAndAdElement() {
List<Permission> result = dao.getAllForRoleAndAdElement(ROLE_ID, AD_ELEMENT_ID);
assertNotNull(result);
assertFalse(result.isEmpty());
for (Permission permission : result) {
assertEquals(ROLE_ID, permission.getRoleId());
assertEquals(AD_ELEMENT_ID, permission.getAdElementId());
}
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class AddDiskCommand method addDiskPermissions.
private void addDiskPermissions(Disk disk) {
if (getCurrentUser() != null) {
Permission perms = new Permission(getCurrentUser().getId(), PredefinedRoles.DISK_OPERATOR.getId(), disk.getId(), VdcObjectType.Disk);
multiLevelAdministrationHandler.addPermission(perms);
}
}
use of org.ovirt.engine.core.common.businessentities.Permission in project ovirt-engine by oVirt.
the class PermissionListModelTable method addCreationDateColum.
private void addCreationDateColum() {
AbstractTextColumn<Permission> creationDateColumn = new AbstractRenderedTextColumn<Permission, Date>(new FullDateTimeRenderer()) {
@Override
public Date getRawValue(Permission object) {
// GWT doesn't have TimeUnit.java
return new Date(object.getCreationDate() * 1000);
}
};
// $NON-NLS-1$
getTable().addColumn(creationDateColumn, constants.permissionsCreationDate(), "300px");
creationDateColumn.makeSortable();
}
Aggregations