Skip to content

Commit

Permalink
improve documentation
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <[email protected]>
  • Loading branch information
kobergj committed Jul 6, 2023
1 parent b47303d commit 22ba896
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/userlog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,20 @@ The `userlog` service provides an API to retrieve configured events. For now, th

Additionally to the oc10 API, the `userlog` service also provides an `/sse` (Server-Sent Events) endpoint to be informed by the server when an event happens. See [What is Server-Sent Events](https://medium.com/yemeksepeti-teknoloji/what-is-server-sent-events-sse-and-how-to-implement-it-904938bffd73) for a simple introduction and examples of server sent events. The `sse` endpoint will respect language changes of the user without needing to reconnect. Note that SSE has a limitation of six open connections per browser which can be reached if one has opened various tabs of the Web UI pointing to the same Infinite Scale instance.

## Posting

The userlog service is able to store global messages that will be displayed to all users and cannot be deleted by them. These messages can be activated by sending a `POST` request to `/ocs/v2.php/apps/notifications/api/v1/notifications/global`. Only one type is supported as of now: `"deprovision"`. Only an user with the admin role is able to call this endpoint.

### Deprovision

Deprovision messages announce the deprovision date of the platform to all users. The text of the message can be changed via translations. (See `Translations` section.) The endpoint expects only a `deprovision_date` parameter in the `POST` request body. It expects the string being in `RFC3339` format. However this format can be changed by using the `deprovision_date_format`. See [go time formating](https://pkg.go.dev/time#pkg-constants) for details.

## Deleting

To delete events for an user, use a `DELETE` request to `ocs/v2.php/apps/notifications/api/v1/notifications` containing the IDs to delete.

Additionally an user with the `admin` role call can send a `DELETE` request to `ocs/v2.php/apps/notifications/api/v1/notifications/global` to remove a global message. (See `Posting` section)

## Translations

The `userlog` service has embedded translations sourced via transifex to provide a basic set of translated languages. These embedded translations are available for all deployment scenarios. In addition, the service supports custom translations, though it is currently not possible to just add custom translations to embedded ones. If custom translations are configured, the embedded ones are not used. To configure custom translations, the `USERLOG_TRANSLATION_PATH` environment variable needs to point to a base folder that will contain the translation files. This path must be available from all instances of the userlog service, a shared storage is recommended. Translation files must be of type [.po](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-Files) or [.mo](https://www.gnu.org/software/gettext/manual/html_node/Binaries.html). For each language, the filename needs to be `userlog.po` (or `userlog.mo`) and stored in a folder structure defining the language code. In general the path/name pattern for a translation file needs to be:
Expand Down

0 comments on commit 22ba896

Please sign in to comment.