use of org.jbei.ice.lib.account.Accounts in project ice by JBEI.
the class UserResource method read.
/**
* @return account information for transfer
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}")
public Response read(@PathParam("id") String userId) {
String user = requireUserId();
Accounts accounts = new Accounts();
return super.respond(accounts.getAccount(user, userId));
}
use of org.jbei.ice.lib.account.Accounts in project ice by JBEI.
the class UserResource method get.
/**
* Retrieves list of users that are available to user making request. Availability is defined by
* being in the same group if the user does not have admin privileges.
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response get(@DefaultValue("0") @QueryParam("offset") int offset, @DefaultValue("15") @QueryParam("limit") int limit, @DefaultValue("lastName") @QueryParam("sort") String sort, @DefaultValue("true") @QueryParam("asc") boolean asc, @QueryParam("filter") String filter) {
String userId = getUserId();
log(userId, "retrieving available accounts");
try {
Accounts accounts = new Accounts();
AccountResults result = accounts.getAvailableAccounts(userId, offset, limit, asc, sort, filter);
return super.respond(result);
} catch (PermissionException pe) {
return super.respond(Response.Status.UNAUTHORIZED);
}
}
use of org.jbei.ice.lib.account.Accounts in project ice by JBEI.
the class UserResource method getAutoCompleteForAvailableAccounts.
/**
* Retrieves (up to specified limit), the list of users that match the value
*
* @param val text to match against users
* @param limit upper limit for number of users to return
* @return list of matching users
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/autocomplete")
public List<AccountTransfer> getAutoCompleteForAvailableAccounts(@QueryParam("val") String val, @DefaultValue("8") @QueryParam("limit") int limit) {
String userId = getUserId();
Accounts accounts = new Accounts();
return accounts.filterAccount(userId, val, limit);
}
Aggregations