Problem/Motivation

When a user does not have permission to administer workspaces, they see the "Publish content" button but get access denied. This is a confusing user interface experience.

Steps to reproduce

Set up the following permissions. Created content on stage. Try to deploy. Access denied

Proposed resolution

Hide button if no permission.

Remaining tasks

Remove out of scope work from the patch, the new permissions. See #22
Review code
Review test

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3213208

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Status: Active » Needs review
manojithape’s picture

StatusFileSize
new100.65 KB
new87.62 KB

Verified and tested patch MR !654 i.e. https://git.drupalcode.org/project/drupal/-/merge_requests/654.patch on the drupal 9.3.x-dev version. Patch applied successfully and looks good to me.

Testing Steps:

  1. Install drupal 9.3.x-dev version.
  2. Install and enable the Workspace module.
  3. As per shared Screen Shot, 2021-05-10 at 9.37.12 AM.png image give permission for author role.
  4. Login as author user and created content on stage.
  5. Try to deploy newly created content by clicking on the "Publish Content" option.
  6. Observe the "Access denied" page displayed because the author user has not permission to publish.
  7. Now apply the patch and verify the "Publish Content" option not displayed if the user has no permission.

Testing Results:

After applying the patch "Publish Content" option not displayed if the user has no permission.
Please refer attached Before patch and After patch screenshot images for reference.

Moving this ticket to RTBC.

manojithape’s picture

Status: Needs review » Reviewed & tested by the community
gauravvvv’s picture

Should we hide the "Publish Content" button if there are no changes to publish?.

Adding screen recording for reference.

larowlan’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Bug Smash Initiative, +Needs tests

@Gauravmahlawat can you open a separate issue for that, nice pick up.

As this is a bug report, we need a test demonstrating the bug so that we can be certain it stays fixed

gauravvvv’s picture

paulocs’s picture

Assigned: Unassigned » paulocs
paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review

I updated the branch and added tests to it.

gabriel.abdalla’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new8.06 KB
new5.02 KB

Hi, changes look good.

Steps performed:
1. Installed 9.3.x-dev version with Umami profile.
2. Enabled module Workspace.
3. Granted permissions to Author role as specified in the issue.
4. Logged in as Author user and created Basic page content. Issue reproduced, "Publish Content" button was visible.
5. Switched to branch 3213208-do-not-show with new code.
6. Code Review on changed files:
--- (a) src/WorkspaceListBuilder.php
--- (b) tests/src/FunctionalJavascript/WorkspaceToolbarIntegrationTest.php
7. Run PHPCS against changed files with standards Drupal and DrupalPractice. No issues introduced in code changes.
8. Tested again with fixes (Admin and Author users) and it's working as expected. Images attached.

mglaman’s picture

Issue tags: -Needs tests

Tests were added, removing tag

keen-on.digital’s picture

I have tested this patch.

After applying the patch, visibility of 'Publish content' button works properly.

But still, users can publish the content by switching into Live workspace even though they do not have 'Administer workspaces' permission.

quietone’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs issue summary update

This needs an issue summary update. Screenshots of before and after, placed in the Issue Summary would also help a reviewer.

I read through the issue and did not see a review of the code or the test. Setting back to NR for that.

Also, that previous comment suggests there is more work to do here. I'll leave that decision to those working on this.

keen-on.digital’s picture

StatusFileSize
new12.92 KB

I have modified the patch and included more detailed user permission to access and manage workspaces.

keen-on.digital’s picture

StatusFileSize
new23.7 KB

Updated patch file for advanced workspace permissions.

chetanbharambe’s picture

Status: Needs review » Needs work
StatusFileSize
new838.18 KB
new351.3 KB
new205.77 KB

Hi @keen-on.digital,
Above Patch #16 test cases are getting failed.
Patch not applied successfully and not working as expected.

Testing Steps:
# Goto: Appearance: Apply Seven theme
# Goto: Extend -> Install Workspace Module
# Give the permission to Author role as mentioned in the issue summary
# Login as author user and created content on stage.
# Try to deploy newly created content by clicking on the "Publish Content" option.
# Observe the "Access denied" page displayed because the author user has no permission to publish.
# Now apply the patch and verify the "Publish Content" option not displayed if the user has no permission.

Expected Results:
# After applying the patch, the "Publish Content" option is not displayed if the user has no permission.

Actual Results:
# Currently, the "Publish Content" option is displayed.

Please refer attached screenshots for the same.
Not working as expected.
Can be a move to Needs Work.

yogeshmpawar’s picture

Assigned: Unassigned » yogeshmpawar

Working on re-roll.

yogeshmpawar’s picture

Assigned: yogeshmpawar » Unassigned
Status: Needs work » Needs review
StatusFileSize
new23.69 KB
new2.32 KB

Re-rolled the patch & removed some extra white trailing spaces which give warnings.

yogeshmpawar’s picture

Resolved custom commands failures & added an interdiff.

Status: Needs review » Needs work

The last submitted patch, 20: 3213208-20.patch, failed testing. View results

amateescu’s picture

@keen-on.digital, adding additional workspace permissions is not in scope of this issue, please open a new issue so it can be discussed properly because it's a feature request.

vikashsoni’s picture

StatusFileSize
new21.73 KB
new25.56 KB

Applied patch #19 working fine after patch publish button has gone if user not access
for ref sharing screenshot .........

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes

@vikashsoni, the comment before yours asked for changes to the patch, and this issue was at NW, there was no need to add screenshots. Therefor, credit has been removed per How is credit granted for Drupal core issues.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.