Search in sources :

Example 11 with Permission

use of org.ovirt.engine.api.model.Permission in project ovirt-engine by oVirt.

the class BackendEntityAssignedPermissionsResourceTest method getModel.

@Override
protected Permission getModel() {
    Permission model = new Permission();
    model.setUser(new User());
    model.getUser().setId(GUIDS[1].toString());
    model.setRole(new Role());
    model.getRole().setId(GUIDS[3].toString());
    return model;
}
Also used : Role(org.ovirt.engine.api.model.Role) User(org.ovirt.engine.api.model.User) Permission(org.ovirt.engine.api.model.Permission)

Example 12 with Permission

use of org.ovirt.engine.api.model.Permission in project ovirt-engine by oVirt.

the class BackendGroupAssignedPermissionsResourceTest method getModel.

@Override
protected Permission getModel() {
    Permission model = new Permission();
    model.setDataCenter(new DataCenter());
    model.getDataCenter().setId(GUIDS[2].toString());
    model.setRole(new Role());
    model.getRole().setId(GUIDS[3].toString());
    return model;
}
Also used : Role(org.ovirt.engine.api.model.Role) DataCenter(org.ovirt.engine.api.model.DataCenter) Permission(org.ovirt.engine.api.model.Permission)

Example 13 with Permission

use of org.ovirt.engine.api.model.Permission in project ovirt-engine by oVirt.

the class BackendGroupAssignedPermissionsResourceTest method testAddIncompletePermission.

@Test
public void testAddIncompletePermission() throws Exception {
    Permission model = new Permission();
    model.setGroup(new Group());
    model.getGroup().setId(GUIDS[1].toString());
    model.setRole(new Role());
    model.getRole().setId(GUIDS[3].toString());
    setUriInfo(setUpBasicUriExpectations());
    try {
        collection.add(model);
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "Permission", "add", "dataCenter|cluster|host|storageDomain|vm|vmPool|template.id");
    }
}
Also used : Role(org.ovirt.engine.api.model.Role) Group(org.ovirt.engine.api.model.Group) WebApplicationException(javax.ws.rs.WebApplicationException) Permission(org.ovirt.engine.api.model.Permission) Test(org.junit.Test)

Example 14 with Permission

use of org.ovirt.engine.api.model.Permission in project ovirt-engine by oVirt.

the class BackendUserAssignedPermissionsResourceTest method getModel.

@Override
protected Permission getModel() {
    Permission model = new Permission();
    model.setDataCenter(new DataCenter());
    model.getDataCenter().setId(GUIDS[2].toString());
    model.setRole(new Role());
    model.getRole().setId(GUIDS[3].toString());
    return model;
}
Also used : Role(org.ovirt.engine.api.model.Role) DataCenter(org.ovirt.engine.api.model.DataCenter) Permission(org.ovirt.engine.api.model.Permission)

Example 15 with Permission

use of org.ovirt.engine.api.model.Permission in project ovirt-engine by oVirt.

the class AbstractBackendAssignedPermissionsResourceTest method testAddPermission.

@Test
public void testAddPermission() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.AddPermission, PermissionsOperationsParameters.class, new String[] { principalParameterName, "Permission.AdElementId", "Permission.ObjectId", "Permission.RoleId" }, new Object[] { GUIDS[1], chooseElementId(), chooseObjectId(), GUIDS[3] }, true, true, GUIDS[0], QueryType.GetPermissionById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
    Permission model = getModel();
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof Permission);
    verifyModel((Permission) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) Permission(org.ovirt.engine.api.model.Permission) Test(org.junit.Test)

Aggregations

Permission (org.ovirt.engine.api.model.Permission)15 Test (org.junit.Test)9 Role (org.ovirt.engine.api.model.Role)8 User (org.ovirt.engine.api.model.User)6 WebApplicationException (javax.ws.rs.WebApplicationException)5 DataCenter (org.ovirt.engine.api.model.DataCenter)3 Group (org.ovirt.engine.api.model.Group)3 Response (javax.ws.rs.core.Response)2 Vm (org.ovirt.engine.api.model.Vm)2 Permissions (org.ovirt.engine.api.model.Permissions)1 DbGroup (org.ovirt.engine.core.common.businessentities.aaa.DbGroup)1 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)1