Skip to content

Commit

Permalink
ACMS-1984: Json api config to display API menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
apathak18 committed Nov 1, 2023
1 parent 754bc18 commit 68e9016
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
14 changes: 14 additions & 0 deletions modules/acquia_cms_common/acquia_cms_common.install
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,17 @@ function acquia_cms_common_update_8009() {
}
}
}

/**
* Implements hook_update_N().
*
* Set disabled FALSE to jsonapi resource for user to API menu.
*/
function acquia_cms_common_update_8301() {
if (\Drupal::moduleHandler()->moduleExists('acquia_cms_headless_ui') &&
($jsonapi_config = \Drupal::configFactory()->getEditable('jsonapi_extras.jsonapi_resource_config.user--user'))) {
if ($jsonapi_config->get('disabled')) {
$jsonapi_config->set('disabled', FALSE)->save(TRUE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dependencies:
module:
- user
id: user--user
disabled: true
disabled: false
path: user/user
resourceType: user--user
resourceFields:
Expand Down Expand Up @@ -134,3 +134,9 @@ resourceFields:
publicName: field_password_expiration
enhancer:
id: ''
field_pending_expire_sent:
disabled: false
fieldName: field_pending_expire_sent
publicName: field_pending_expire_sent
enhancer:
id: ''
2 changes: 1 addition & 1 deletion tests/src/ExistingSite/DecoupledTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function testResourceTypes(?array $roles) {

// The user resource type should be disabled, so we should not be able to
// do anything with it.
$this->assertResourceType(FALSE, $this->createUser(), [
$this->assertResourceType(TRUE, $this->createUser(), [
'PATCH' => [
'display_name' => 'Superman',
],
Expand Down

0 comments on commit 68e9016

Please sign in to comment.