Search in sources :

Example 1 with Groups

use of org.jbei.ice.lib.group.Groups in project ice by JBEI.

the class GroupResource method createGroup.

@POST
@Produces(MediaType.APPLICATION_JSON)
public Response createGroup(UserGroup userGroup) {
    try {
        String userId = requireUserId();
        Groups groups = new Groups(userId);
        return super.respond(groups.addGroup(userGroup));
    } catch (PermissionException pe) {
        return super.respond(Response.Status.FORBIDDEN);
    }
}
Also used : PermissionException(org.jbei.ice.lib.access.PermissionException) Groups(org.jbei.ice.lib.group.Groups)

Example 2 with Groups

use of org.jbei.ice.lib.group.Groups in project ice by JBEI.

the class GroupResource method matchGroupNames.

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/autocomplete")
public Response matchGroupNames(@QueryParam("token") String token, @DefaultValue("8") @QueryParam("limit") int limit) {
    String userId = requireUserId();
    Groups groups = new Groups(userId);
    return super.respond(groups.getMatchingGroups(token, limit));
}
Also used : Groups(org.jbei.ice.lib.group.Groups)

Example 3 with Groups

use of org.jbei.ice.lib.group.Groups in project ice by JBEI.

the class UserResource method getProfileGroups.

/**
 * @return group listing for a user
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}/groups")
public Response getProfileGroups(@PathParam("id") long userId) {
    String userIdStr = requireUserId();
    log(userIdStr, " get profile groups");
    Groups userGroups = new Groups(userIdStr);
    return super.respond(userGroups.get(userId));
}
Also used : Groups(org.jbei.ice.lib.group.Groups)

Example 4 with Groups

use of org.jbei.ice.lib.group.Groups in project ice by JBEI.

the class GroupResource method updateGroup.

@PUT
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}")
public Response updateGroup(@PathParam("id") long id, UserGroup group) {
    String userId = requireUserId();
    Groups groups = new Groups(userId);
    return respond(groups.update(id, group));
}
Also used : Groups(org.jbei.ice.lib.group.Groups)

Example 5 with Groups

use of org.jbei.ice.lib.group.Groups in project ice by JBEI.

the class GroupResource method getGroupMembers.

@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}/members")
public Response getGroupMembers(@PathParam("id") long id) {
    String userId = requireUserId();
    Groups groups = new Groups(userId);
    return super.respond(groups.getGroupMembers(id));
}
Also used : Groups(org.jbei.ice.lib.group.Groups)

Aggregations

Groups (org.jbei.ice.lib.group.Groups)6 PermissionException (org.jbei.ice.lib.access.PermissionException)1 GroupType (org.jbei.ice.lib.dto.group.GroupType)1