Search in sources :

Example 16 with Group

use of org.ovirt.engine.api.model.Group 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 17 with Group

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

the class GroupMapper method map.

@Mapping(from = DirectoryGroup.class, to = Group.class)
public static Group map(DirectoryGroup entity, Group template) {
    Group model = template != null ? template : new Group();
    model.setName(entity.getName());
    if (!StringUtils.isEmpty(entity.getDirectoryName())) {
        Domain dom = new Domain();
        dom.setName(entity.getDirectoryName());
        dom.setId(DirectoryEntryIdUtils.encode(dom.getName()));
        model.setDomain(dom);
    }
    model.setId(DirectoryEntryIdUtils.encode(entity.getId()));
    model.setNamespace(entity.getNamespace());
    return model;
}
Also used : Group(org.ovirt.engine.api.model.Group) DbGroup(org.ovirt.engine.core.common.businessentities.aaa.DbGroup) DirectoryGroup(org.ovirt.engine.core.aaa.DirectoryGroup) AuthzGroup(org.ovirt.engine.core.common.businessentities.aaa.AuthzGroup) Domain(org.ovirt.engine.api.model.Domain)

Example 18 with Group

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

the class GroupMapper method map.

@Mapping(from = AuthzGroup.class, to = Group.class)
public static Group map(AuthzGroup authzGroup, Group template) {
    Group model = template != null ? template : new Group();
    model.setId(DirectoryEntryIdUtils.encode(authzGroup.getId()));
    model.setName(authzGroup.getName());
    model.setNamespace(authzGroup.getNamespace());
    if (!StringUtils.isEmpty(authzGroup.getAuthz())) {
        Domain dom = new Domain();
        dom.setName(authzGroup.getAuthz());
        dom.setId(DirectoryEntryIdUtils.encode(dom.getName()));
        model.setDomain(dom);
    }
    return model;
}
Also used : Group(org.ovirt.engine.api.model.Group) DbGroup(org.ovirt.engine.core.common.businessentities.aaa.DbGroup) DirectoryGroup(org.ovirt.engine.core.aaa.DirectoryGroup) AuthzGroup(org.ovirt.engine.core.common.businessentities.aaa.AuthzGroup) Domain(org.ovirt.engine.api.model.Domain)

Example 19 with Group

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

the class BackendGroupTagResource method addParents.

@Override
protected Tag addParents(Tag tag) {
    Group group = new Group();
    group.setId(groupId.toString());
    tag.setGroup(group);
    return tag;
}
Also used : Group(org.ovirt.engine.api.model.Group)

Aggregations

Group (org.ovirt.engine.api.model.Group)19 DbGroup (org.ovirt.engine.core.common.businessentities.aaa.DbGroup)12 DirectoryGroup (org.ovirt.engine.core.aaa.DirectoryGroup)11 Test (org.junit.Test)8 Domain (org.ovirt.engine.api.model.Domain)5 AbstractBackendCollectionResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)5 Response (javax.ws.rs.core.Response)4 WebApplicationException (javax.ws.rs.WebApplicationException)3 Groups (org.ovirt.engine.api.model.Groups)3 Permission (org.ovirt.engine.api.model.Permission)3 User (org.ovirt.engine.api.model.User)3 AuthzGroup (org.ovirt.engine.core.common.businessentities.aaa.AuthzGroup)3 DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)3 Role (org.ovirt.engine.api.model.Role)2 BaseResource (org.ovirt.engine.api.model.BaseResource)1 Roles (org.ovirt.engine.api.model.Roles)1 V3Group (org.ovirt.engine.api.v3.types.V3Group)1 DirectoryUser (org.ovirt.engine.core.aaa.DirectoryUser)1