Closed (fixed)
Project:
Search API Synonym
Version:
3.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Feb 2019 at 22:59 UTC
Updated:
31 May 2025 at 18:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
aaron.ferris commentedComment #4
aaron.ferris commentedComment #5
aaron.ferris commentedAdded 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"}}}Comment #6
aaron.ferris commentedTesting 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_synonym
Expected: 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_synonym
Expected: The synonyms should not be viewable (we should see the same response from the original ticket description).
Comment #7
brandonlira commentedHi @aaron.ferris
Manually tested MR !25.
`The 'administer search api synonyms' permission is required`when accessing`/jsonapi/search_api_synonym/search_api_synonym`.`View search api synonyms`to the Anonymous role.Comment #8
aaron.ferris commented