Files

73 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

2020-09-23 11:48:59 +02:00
---
2020-09-21 12:42:36 +02:00
title: "Settings Values"
date: 2020-05-04T00:00:00+00:00
weight: 51
geekdocRepo: https://github.com/owncloud/ocis
2022-06-20 17:09:04 +02:00
geekdocEditPath: edit/master/docs/services/settings
2020-09-23 11:48:59 +02:00
geekdocFilePath: values.md
---
2020-09-21 12:42:36 +02:00
A **Settings Value** is the value an authenticated user has chosen for a specific setting, defined in a
2023-01-26 21:52:45 +01:00
*settings bundle*.
2020-09-21 12:42:36 +02:00
## Identifying settings values
2020-09-23 11:48:59 +02:00
A *settings value* is uniquely identified by four attributes. Three of them are coming from the definition of
2021-04-13 08:31:20 +02:00
the setting within it's settings bundle (see [Settings Bundles]({{< ref "bundles" >}})
2020-09-21 12:42:36 +02:00
for an example). The fourth identifies the user.
2020-09-23 11:48:59 +02:00
- extension: Key of the extension that registered the settings bundle,
- bundleKey: Key of the settings bundle,
- settingKey: Key of the setting as defined within the bundle,
- accountUuid: The UUID of the authenticated user who has saved the setting.
2020-09-21 12:42:36 +02:00
2020-09-23 11:48:59 +02:00
{{< hint info >}}
2020-09-21 12:42:36 +02:00
When requests are going through `ocis-proxy`, the accountUuid attribute can be set to the static keyword `me`
instead of using a real UUID. `ocis-proxy` will take care of minting the UUID of the authenticated user into
a JWT, providing it in the HTTP header as `x-access-token`. That UUID is then used in this service, to replace
`me` with the actual UUID of the authenticated user.
2020-09-23 11:48:59 +02:00
{{< /hint >}}
2020-09-21 12:42:36 +02:00
## Example of stored settings values
```json
{
"values": {
"language": {
"identifier": {
"extension": "ocis-accounts",
"bundleKey": "profile",
"settingKey": "language",
"accountUuid": "5681371f-4a6e-43bc-8bb5-9c9237fa9c58"
},
"listValue": {
"values": [
{
"stringValue": "de"
}
]
}
},
"timezone": {
"identifier": {
"extension": "ocis-accounts",
"bundleKey": "profile",
"settingKey": "timezone",
"accountUuid": "5681371f-4a6e-43bc-8bb5-9c9237fa9c58"
},
"listValue": {
"values": [
{
"stringValue": "Europe/Berlin"
}
]
}
}
}
}
```
## gRPC endpoints
2023-01-26 21:52:45 +01:00
Services can use gRPC endpoints of the `ValueService` to query and modify *settings values*.
2020-09-21 12:42:36 +02:00
The gRPC endpoints require the same identifier attributes as described above, so for making a request to
the `ValueService` you will have to make sure that the accountUuid of the authenticated user is available in
your service at the time of the request.