use of org.dcache.vehicles.quota.PnfsManagerGetQuotaMessage in project dcache by dCache.
the class QuotaResources method getUserQuotas.
@GET
@ApiOperation("Get information about all user quotas known to the system." + " Results sorted lexicographically by user id.")
@ApiResponses({ @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 503, message = "DCache not configured for quota management.") })
@Path("/user")
@Produces(MediaType.APPLICATION_JSON)
public List<QuotaInfo> getUserQuotas(@ApiParam(value = "Return user quota associated with " + "calling user only.") @DefaultValue("false") @QueryParam("user") boolean user) {
checkAuthenticated();
PnfsManagerGetQuotaMessage message;
if (user) {
message = new PnfsManagerGetQuotaMessage((int) Subjects.getUid(RequestUser.getSubject()), QuotaType.USER);
} else {
message = new PnfsManagerGetQuotaMessage(QuotaType.USER);
}
return getQuotas(message);
}
use of org.dcache.vehicles.quota.PnfsManagerGetQuotaMessage in project dcache by dCache.
the class QuotaResources method getGroupQuotas.
@GET
@ApiOperation("Get information about all group quotas known to the system." + " Results sorted lexicographically by group id.")
@ApiResponses({ @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal Server Error"), @ApiResponse(code = 503, message = "DCache not configured for quota management.") })
@Path("/group")
@Produces(MediaType.APPLICATION_JSON)
public List<QuotaInfo> getGroupQuotas(@ApiParam(value = "Return group quota associated with " + "calling user only.") @DefaultValue("false") @QueryParam("user") boolean user) {
checkAuthenticated();
PnfsManagerGetQuotaMessage message;
/*
* REVISIT --- we may eventually want another option to return all the user's gids.
*/
if (user) {
message = new PnfsManagerGetQuotaMessage((int) Subjects.getPrimaryGid(RequestUser.getSubject()), QuotaType.GROUP);
} else {
message = new PnfsManagerGetQuotaMessage(QuotaType.GROUP);
}
return getQuotas(message);
}
Aggregations