Skip to content
Snippets Groups Projects
Commit 1c299c6d authored by Angie Byron's avatar Angie Byron
Browse files

Issue #3068275 by Wim Leers, alexpott, shimpy, gabesullice, xjm: Add status...

Issue #3068275 by Wim Leers, alexpott, shimpy, gabesullice, xjm: Add status report message about JSON:API's read-only mode
parent 7b5662f5
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
* Module install file. * Module install file.
*/ */
use Drupal\Core\Url;
/** /**
* Implements hook_install(). * Implements hook_install().
*/ */
...@@ -58,7 +60,18 @@ function jsonapi_requirements($phase) { ...@@ -58,7 +60,18 @@ function jsonapi_requirements($phase) {
':jsonapi-docs' => 'https://www.drupal.org/docs/8/modules/jsonapi/revisions', ':jsonapi-docs' => 'https://www.drupal.org/docs/8/modules/jsonapi/revisions',
]), ]),
]; ];
$requirements['jsonapi_read_only_mode'] = [
'title' => t('JSON:API allowed operations'),
'value' => t('Read-only'),
'severity' => REQUIREMENT_INFO,
];
if (!\Drupal::configFactory()->get('jsonapi.settings')->get('read_only')) {
$requirements['jsonapi_read_only_mode']['value'] = t('All (create, read, update, delete)');
$requirements['jsonapi_read_only_mode']['description'] = t('It is recommended to <a href=":configure-url">configure</a> JSON:API to only accept all operations if the site requires it. <a href=":docs">Learn more about securing your site with JSON:API.</a>', [
':docs' => 'https://www.drupal.org/docs/8/modules/jsonapi/security-considerations',
':configure-url' => Url::fromRoute('jsonapi.settings')->toString(),
]);
}
} }
return $requirements; return $requirements;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment