Package nzilbb.labbcat.server.api.admin
Class Activity
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.admin.Activity
-
@RequiredRole("admin") public class Activity extends APIRequestHandler
/api/admin/activity : Tracks current user activity on certain admin pages.Pages that involve editing administration settings may be open for long periods while the user is editing configuration. If multiple users are editing the same settings simulataneously, saving can overwrite the changes recently made by another user. In order to prevent this, current access to certain pages is tracked, so that users can see whether another user is currently changing settings.
The user interface of such pages regularly polls this endpoint to both register the user's access, and also monitor the access of other users. The polling request's user ID is inferred from their login session, and the Referer request header is used to infer which page they have open.
The only method supported is:
- GET
-
- Optional parameters
- resource Resource identifier, which defaults to the referer.
- viewport A unique identifier for the browser window/tab, allowing users with multiple tabs open to see other tabs in the list of other users.
- Response Body - the standard JSON envelope, returning as the 'model' an array of strings representing IDs of other users that currently have the page open. If the user's own ID is in this list, it's because they have the page open in more than one viewport (browser tab).
- Response Status - 200 unless the page being viewed cannot be inferred, in which case 400 is returned.
- Optional parameters
- Author:
- Robert Fromont
-
-
Field Summary
-
Fields inherited from class nzilbb.labbcat.server.api.APIRequestHandler
SC_BAD_REQUEST, SC_CONFLICT, SC_CREATED, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_METHOD_NOT_ALLOWED, SC_NOT_FOUND, SC_OK, SC_UNAUTHORIZED, SC_UNPROCESSABLE_CONTENT, SC_UNSUPPORTED_MEDIA_TYPE
-
-
Constructor Summary
Constructors Constructor Description Activity()Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.json.JsonObjectget(RequestParameters parameters, UnaryOperator<String> requestHeaders, Consumer<Integer> httpStatus)Register admin page access.-
Methods inherited from class nzilbb.labbcat.server.api.APIRequestHandler
getContext, GetSystemAttribute, init, writeResponse
-
-
-
-
Method Detail
-
get
public javax.json.JsonObject get(RequestParameters parameters, UnaryOperator<String> requestHeaders, Consumer<Integer> httpStatus)
Register admin page access.- Parameters:
parameters- Request parameter map.requestHeaders- Access to HTTP request headers.httpStatus- Receives the response status code, in case of error.- Returns:
- A JSON object as the request response.
-
-