Problem/Motivation
#3160148: Add access permission check to "View JSON" operation link
#3160149: Fix "View API Documentation" link in entity operations
Steps to reproduce
Given that a "Site Admin" was logged in to the site
When navigating to"/admin/content"
And clicked on the "Operations" options for a content
And API resource type was activated for the content type
Then should see "View JSON"
And should see"View API Docs"
And not to show up for other user roles.
Proposed resolution
Grant "Site Admin" user role the following permissions:
- "access view api docs entity operation"
- "access view json entity operation"
Remaining tasks
- ✅ File an issue about this project
- ✅ Change permissions for "Site Admin" user role to access JSON:API and API Docs
- ✅ Testing to ensure no regression
- ✅ Automated unit/functional testing coverage
- ✅ Developer Documentation support on feature change/addition
- ➖ User Guide Documentation support on feature change/addition
- ✅ Code review from 1 Varbase core team member
- ✅ Full testing and approval
- ✅ Credit contributors
- ✅ Review with the product owner
- ✅ Release varbase-9.0.2
User interface changes
Only View JSON

View JSON with View API Docs

API changes
- N/A
Data model changes
- N/A
New Gherkin scenarios for the JSON:API
@javascript @check @local @development @staging @production
Scenario: Check that Site Admin users can access "View JSON" and "View API Docs" entity operations
Given I am a logged in user with the "test_site_admin" user
When I go to "/admin/content"
And I wait
Then I should see "Content"
And I should see the "View JSON" operation for the "Homepage" content
And I should see the "View API Docs" operation for the "Homepage" content
And I should see the "Edit" operation for the "Homepage" content
And I should see the "Layout" operation for the "Homepage" content
And I should see the "View JSON" operation for the "Blog" content
And I should see the "View API Docs" operation for the "Blog" content
When I go to "/admin/content/media"
And I wait
Then I should see "Media"
And I should see the "View JSON" operation for the "Media entity test" media
And I should see the "View API Docs" operation for the "Media entity test" media
And I should see the "Edit" operation for the "Media entity test" media
When I go to "/admin/structure/taxonomy/manage/tags/overview"
And I wait
Then I should see "Tags"
And I should see "space"
And I should not see the "View JSON" operation for the "space" term
And I should not see the "View API Docs" operation for the "space" term
When I go to "/admin/structure/entityqueue"
And I wait
Then I should see "Entityqueues"
And I should not see the "View JSON" operation for the "Media Hero Slider" entity
And I should not see the "View API Docs" operation for the "Media Hero Slider" entity
But I should not see the "Edit items" operation for the "Media Hero Slider" entity
@javascript @check @local @development @staging @production
Scenario: Check that Content Admin users can not access "View JSON" and "View API Docs" entity operations
Given I am a logged in user with the "test_content_admin" user
When I go to "/admin/content"
And I wait
Then I should see "Content"
And I should not see the "View JSON" operation for the "Homepage" content
And I should not see the "View API Docs" operation for the "Homepage" content
But I should see the "Edit" operation for the "Homepage" content
And I should see the "Layout" operation for the "Homepage" content
When I go to "/admin/content/media"
And I wait
Then I should see "Media"
And I should not see the "View JSON" operation for the "Media entity test" media
And I should not see the "View API Docs" operation for the "Media entity test" media
But I should see the "Edit" operation for the "Media entity test" media
When I go to "/admin/structure/taxonomy/manage/tags/overview"
And I wait
Then I should see "Tags"
And I should see "space"
And I should not see the "View JSON" operation for the "space" term
And I should not see the "View API Docs" operation for the "space" term
When I go to "/admin/structure/entityqueue"
And I wait
Then I should see "Entityqueues"
And I should not see the "View JSON" operation for the "Media Hero Slider" entity
And I should not see the "View API Docs" operation for the "Media Hero Slider" entity
But I should not see the "Edit items" operation for the "Media Hero Slider" entity
@javascript @check @local @development @staging @production
Scenario: Check that Editor users can access "View JSON" and "View API Docs" entity operations
Given I am a logged in user with the "test_editor" user
When I go to "/admin/content"
And I wait
Then I should see "Content"
And I should not see the "View JSON" operation for the "Homepage" content
And I should not see the "View API Docs" operation for the "Homepage" content
But I should see the "Edit" operation for the "Homepage" content
And I should see the "Layout" operation for the "Homepage" content
When I go to "/admin/content/media"
And I wait
Then I should see "Media"
And I should not see the "View JSON" operation for the "Media entity test" media
And I should not see the "View API Docs" operation for the "Media entity test" media
But I should see the "Edit" operation for the "Media entity test" media
When I go to "/admin/structure/taxonomy/manage/tags/overview"
And I wait
Then I should see "Tags"
And I should see "space"
And I should not see the "View JSON" operation for the "space" term
And I should not see the "View API Docs" operation for the "space" term
Using 2 new distinction steps
/**
* Check if an entity has a specific operation link.
*
* Varbase Context #varbase.
*
* Example 1: Then I should see the "Edit" operation for the "Homepage" entity
* Example 2: Then I should see "Layout" operation for the "Homepage"
* Example 3: Then see "Edit" operation for "Homepage"
* Example 4: Then should see "Delete" operation for the "Blog" entity
* Example 5: Then I should see "Clone" operation for the "Homepage" entity
*
* @Then /^(?:|I )(?:|should )see (?:|the )"([^"]*)" operation for the "([^"]*)" (?:|entity|content|media|file|term|user)$/
*/
/**
* Check if an entity not having a specific operation link.
*
* Varbase Context #varbase.
*
* Example 1: Then I should not see the "View API" operation for the "Homepage" entity
* Example 2: Then I should not see "View API Docs" operation for the "Homepage"
* Example 3: Then not see "Delete" operation for "Homepage"
* Example 4: Then should not see "Delete" operation for the "Blog" entity
* Example 5: Then I should not see "Clone" operation for the "Homepage" entity
*
* @Then /^(?:|I )(?:|should )not see (?:|the )"([^"]*)" operation for the "([^"]*)" (?:|entity|content|media|file|term|user)$/
*/
Comments
Comment #2
rajab natshahComment #3
rajab natshahComment #4
rajab natshahComment #5
rajab natshahComment #6
rajab natshahComment #8
rajab natshahComment #9
rajab natshahComment #10
rajab natshahComment #11
rajab natshahComment #12
rajab natshahComment #14
rajab natshah