- 🇬🇧United Kingdom aaron.ferris
Added a permission/entity view hook for this.
Example jsonapi response with an anonymous user, with access to view
{"jsonapi":{"version":"1.0","meta":{"links":{"self":{"href":"http:\/\/jsonapi.org\/format\/1.0\/"}}}},"data":[{"type":"search_api_synonym--search_api_synonym","id":"abb09e71-552d-4ad0-bf75-804b0e969469","links":{"self":{"href":"https:\/\/drupal-11.ddev.site\/jsonapi\/search_api_synonym\/search_api_synonym\/abb09e71-552d-4ad0-bf75-804b0e969469"}},"attributes":{"drupal_internal__sid":4,"langcode":"en","search_api_synonym_type":"spelling_error","word":"marmelade","synonyms":"marmalade,mermelad,marmellade","status":true,"created":"2025-04-27T13:01:40+00:00","changed":"2025-04-27T13:01:40+00:00","field_asddsadasd":null},"relationships":{"uid":{"data":{"type":"user--user","id":"1f83400a-0892-4ed0-99b3-1379d9c831b3","meta":{"drupal_internal__target_id":1}},"links":{"related":{"href":"https:\/\/drupal-11.ddev.site\/jsonapi\/search_api_synonym\/search_api_synonym\/abb09e71-552d-4ad0-bf75-804b0e969469\/uid"},"self":{"href":"https:\/\/drupal-11.ddev.site\/jsonapi\/search_api_synonym\/search_api_synonym\/abb09e71-552d-4ad0-bf75-804b0e969469\/relationships\/uid"}}}}}],"links":{"self":{"href":"https:\/\/drupal-11.ddev.site\/jsonapi\/search_api_synonym\/search_api_synonym"}}}
- 🇬🇧United Kingdom aaron.ferris
Testing steps
1. Enable this module
2. Enable jsonapi
3. Assign the new permission view search api synonyms to relevant roles
4. Go to /jsonapi/search_api_synonym/search_api_synonymExpected: if the user has the permission, they should be able to view the synonyms as json
1. Remove the permission from the same roles
2. Go to /jsonapi/search_api_synonym/search_api_synonymExpected: The synonyms should not be viewable (we should see the same response from the original ticket description).
- 🇧🇷Brazil brandonlira
Hi @aaron.ferris
Manually tested MR !25.
- Confirmed the issue initially: anonymous users received
`The 'administer search api synonyms' permission is required`
when accessing`/jsonapi/search_api_synonym/search_api_synonym`
. - Checked out the MR !25 branch locally.
- Created two synonym entries (one regular synonym and one spelling error) to test.
- Granted the new permission
`View search api synonyms`
to the Anonymous role. - Retested the endpoint as an anonymous user.
- Synonym entities were successfully returned in the JSON:API response.
- Removing the permission again blocks access as expected.
- Confirmed the issue initially: anonymous users received
-
aaron.ferris →
committed 61ad3acd on 3.0.x
Issue #3034927: add a view synonym permission
-
aaron.ferris →
committed 61ad3acd on 3.0.x
Automatically closed - issue fixed for 2 weeks with no activity.