Skip to content

Commit e9a80bd

Browse files
authored
Merge pull request #13166 from nextcloud/feat/developer_manual/declarative_settings
feat: sensitive declarative settings
2 parents 4f8f72c + 09db08d commit e9a80bd

File tree

4 files changed

+44
-1
lines changed

4 files changed

+44
-1
lines changed

developer_manual/digging_deeper/declarative_settings.rst

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,4 +448,39 @@ Select and Multi-select
448448
'options' => ['foo', 'bar', 'baz'], // simple options for select, radio, multi-select
449449
'placeholder' => 'Select some multiple options', // input placeholder
450450
'default' => ['foo', 'bar'],
451-
],
451+
],
452+
453+
454+
Sensitive field type
455+
--------------------
456+
457+
Since Nextcloud 32 there is a new field attribute ``sensitive: true/false`` available for ``DeclarativeSettingsTypes::TEXT``, ``DeclarativeSettingsTypes::PASSWORD`` types.
458+
The values of such fields are stored in an encrypted form in the database and are not exposed to the UI.
459+
460+
461+
.. code-block:: php
462+
463+
[
464+
'id' => 'test_sensitive_field',
465+
'title' => 'Sensitive text field',
466+
'description' => 'Set some secure value setting that is stored encrypted',
467+
'type' => DeclarativeSettingsTypes::TEXT,
468+
'label' => 'Sensitive field',
469+
'placeholder' => 'Set secure value',
470+
'default' => '',
471+
'sensitive' => true, // only for TEXT, PASSWORD types
472+
],
473+
[
474+
'id' => 'test_sensitive_field_2',
475+
'title' => 'Sensitive password field',
476+
'description' => 'Set some password setting that is stored encrypted',
477+
'type' => DeclarativeSettingsTypes::PASSWORD,
478+
'label' => 'Sensitive field',
479+
'placeholder' => 'Set secure value',
480+
'default' => '',
481+
'sensitive' => true, // only for TEXT, PASSWORD types
482+
],
483+
484+
.. figure:: ../images/declarative_settings_sensitive.png
485+
:alt: sensitive fields
486+

developer_manual/exapp_development/tech_details/api/appconfig.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ AppConfig
44

55
The ExApp AppConfig API is similar to the standard Nextcloud **appconfig** API.
66

7+
.. note::
8+
Since Nextcloud 32, sensitive config values are encrypted in the database.
9+
10+
711
Set app config value
812
^^^^^^^^^^^^^^^^^^^^
913

@@ -24,6 +28,7 @@ Request data
2428
"sensitive": "sensitive flag affecting the visibility of the value (0/1, default: 0)"
2529
}
2630
31+
2732
Response data
2833
*************
2934

developer_manual/exapp_development/tech_details/api/preferences.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Preferences
55
The ExApp preferences API is similar to the standard preferences API.
66
It is a user specific setting.
77

8+
.. note::
9+
Since Nextcloud 32, sensitive config values are encrypted in the database.
10+
811

912
Set user config value
1013
^^^^^^^^^^^^^^^^^^^^^
20.3 KB
Loading

0 commit comments

Comments
 (0)