Problem/Motivation

Follow up to #576296: Remove redundant description for some permissions

Yoroy noted in comment #33 there that the descriptions on the "Revert all revisions", "Delete all revisions", and "Revert/delete TYPE revisions" permissions were confusing. These are in node.permissions.yml and the NodePermissions class, and they look something like this:
Role requires permission to <em>view revisions</em> and <em>edit rights</em> for nodes in question or <em>administer nodes</em>.

So I looked at the logic in the NodeRevisionAccessCheck class, which is the only place (outside of tests) in Core that these permission strings appear.... and I think that those descriptions are actually wrong.

What they should say is that in order to revert or delete revisions, you also need to either have 'administer nodes' permission, or permission to edit the given node. Actually the 'view revisions' permission is not needed, as far as I can tell.

Proposed resolution

All of these strings should be modified to say something like:

Reverting a revision also requires permission to edit the content.
Deleting a revision also requires permission to edit the content.

[Note: We should never use the word "node" in the UI! This wording would be consistent with the names/descriptions of other Node module permissions.]

Remaining tasks

Make a patch.

User interface changes

Correct descriptions for the node revision revert/delete permissions.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon created an issue. See original summary.

felribeiro’s picture

Status: Active » Needs review
FileSize
1.83 KB
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks right to me, and thanks for the quick action!

I wonder if we should try to get this into 8.0.x as well. It's a UI text change, but it is a bug because the text is incorrect. Anyway... good for 8.1.x for sure.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

catch’s picture

Status: Reviewed & tested by the community » Needs review

While these might be technically wrong, is there actually a way to actually do this via the UI with just those permissions? As far as I know you need to be able to view revisions to be able to delete them in practice.

jhodgdon’s picture

Well, in theory you could go directly to the URL for deleting a revision, without clicking on a Delete or Revert link in the UI.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

And just as a note, we don't say on the "delete xyz type of node" permission that you need "view node" or "edit node" permission either, even though in the UI you would need to be on an Edit page to see the link that deletes it. In this case too, if you went to the URL directly, like node/123/delete, the only permission that would be checked is delete. So to me this seems to be consistent. If you go directly to the revision delete URL, it does check that you have permission to edit the node; it doesn't check that you have permission to view or edit or revert revisions.

catch’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs usability review

Well that's also a bug, there's been an issue open to resolve it since just after the delete permission was added in 2007 #196758: Having delete as a button on the node edit form means certain users don't have access to it when they should. So we might make it consistent with the delete permission, but we could equally adjust the node delete permissions description to make it consistent with this one (or change both).

I think there's actually some other ways to get to the delete operation now like contextual links and admin/content maybe, but there's no such mechanism for revisions, so it's not entirely equivalent either.

Moving back to CNR and tagging 'needs usability review'.

yoroy’s picture

So we might make it consistent with the delete permission, but we could equally adjust the node delete permissions description to make it consistent with this one (or change both).

I'm losing track of which refers to what here :)

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Umm.... Technically, you do not need View permission to delete a node, nor do you need View Revision permission to delete a node revision. You do need Edit permission on the node in order to delete a revision. You do not need Edit permission on the node in order to delete the node.

That is separate from the UI considerations (where the buttons are displayed in the default UI).... However, you can definitely make a UI using Views and bulk ops that will let you delete a node or a revision without being on a view or edit screen, and in that case, you would only need the permissions noted in the issue summary.

So... I think this patch is correct. After this patch, it will say that to delete/revert a revision, you need edit permissions on the content (which is correct, independent of a UI/View that you might be using to do the operation). And it will not have a similar note on the delete node permissions, because that permission is not required.

In other words, I believe #8 is incorrect -- I think we should *not* say that you need any additional permissions to delete nodes -- you don't (if you can access the links, type in the URL directly, or use bulk ops on a view). And for revisions, similarly, if you have some way to access the operation (like bulk ops on a view), you do need edit node permission to delete or revert a revision, but you don't need view revision permission.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 2678178-2.patch, failed testing.

jhodgdon’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated test failure.

xjm’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
FileSize
51.73 KB

This issue is still tagged for a usability review (@yoroy did not have enough information above to provide the review).

I confirmed that nodes can be deleted without permission to edit the node or to view revisions, and similarly, revisions can can be deleted without permission to edit. In both cases, visiting the link directly or a similar operation is allowed. So, it's misleading to have this description on only the revision permissions while the similar content permissions have none. I've attached a screenshot to illustrate.

Edit: What does appear to be true is that you must be able to delete the given content in order to be able to delete a revision of it.

I think the questions in scope for this issue are:

  1. Is the updated text sufficiently clear for site builders to understand what additional permissions are needed in order to delete the revisions?
  2. Should we add a similar description to the content delete permissions in addition to the revision delete permissions?
  3. Or, should we instead simply remove all four of these descriptions, since they are not entirely correct either in HEAD or in the patch, and since reducing the textual load actually makes it easier for users to use a page?
  4. Edit: Or, should we come up with a different wording that indicates revisions can only be deleted if the content can be deleted (even without permission to view or edit)?
xjm’s picture

Edit: incorporating above for clarity.

jhodgdon’s picture

Oh, you're right! I think the issue summary (and the patch) are incorrect...

Is this your understanding:
- To delete revisions, you also need permission to delete the node (but not to view or edit it).
- To revert revisions, you also need permission to edit the node (but not to view or delete it).
- To view revisions, you also need permission to view the node (but not to edit or delete it).
- To view/delete/edit nodes, you don't need any revision permissions.
- Administer nodes and bypass all node permissions override any of these.

Is that right? If so, I think we should update the patch.

jhodgdon’s picture

Status: Needs review » Needs work
Sahil Khambra’s picture

I have made a path as per the suggestion. it's my first patch :)

Sahil Khambra’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Status: Needs review » Needs work

Thanks! This is a great start. I think it needs a bit of improvement though -- and these comments apply to all of the permission descriptions (just used the first one as an example):

+++ b/core/modules/node/node.permissions.yml
@@ -19,12 +19,13 @@ view own unpublished content:
+  description: 'To view revisions, <em>you also need permission to view the node</em> (but not to edit or delete it).'

a) Let's not put in all the (but....) parts in these permission descriptions. I think that pertains more to the discussion we had on the issue, but will just confuse users when they see it (without the context of this issue) in the Permissions page.

b) We don't use the word "node" in user-facing text.

Use "content item" instead.

c) There is a bit of a grammatical disconnect here. "To view revisions" and "the node" -- revisions is plural, but node is singular. Let's make them either both singular or both plural. I think singular is probably preferable?

So, something like: To view a revision, you also need permission to view the content item.

rajeshwari10’s picture

Assigned: Unassigned » rajeshwari10
Status: Needs work » Needs review
FileSize
2.65 KB

Adding Patch as per instructions in #19.

Thanks!!

jhodgdon’s picture

Status: Needs review » Needs work
+++ b/core/modules/node/node.permissions.yml
@@ -19,12 +19,13 @@ view own unpublished content:
+  description: 'To view a revision, <em>you also need permission to view the content item</em> (but not to edit or delete it).'

Again, please take out the (but not to...) part in all of these permissions.

rajeshwari10’s picture

Status: Needs work » Needs review
FileSize
2.47 KB

Hi Jhodgdon,

I have done the changes.

Please review,

Thanks!!

jhodgdon’s picture

This looks great to me. The descriptions are simple, clear, and correct.

I'll leave it for a few days at Needs Review and hopefully the Usability folks will give it a review, but otherwise I am ready to mark it RTBC. Thanks!

rajeshwari10’s picture

Hi Jhodgdon,

Any updates??

Thanks!!

jhodgdon’s picture

Sorry, this is still waiting for a Usability team review (hence the "Needs usability review" tag). I could mark it RTBC but I think the core branch maintainers would just put it back to Needs Review if I did.

Bojhan’s picture

Issue tags: -Needs usability review

I am reviewing this but its difficult to understand all the complications. Sorry, that these reviews are sometimes slow - allocating required time for complex issues is not easy.

The challenges I see:

  • We should not use "nodes", in the Human Interface Guidelines we indicate viable alternatives.
  • Using the word "also" seems conversational, is this needed to convey the message?
  • Overall can we cut words to make it more scannable? It looks like a lot of condition/repetition now.

I am unable to really evaluate how it compares to the triangulation of permissions :) But each permission seems to clearly indicate which other permissions are required.

Would anyone want to provide a permission without doing the underlying step (e.g. not granting edit the content item when they want people to revert a revision)?

Overall it feels very close, and would not constitute another usability review before commit.

ftyre76’s picture

Status: Needs review » Reviewed & tested by the community

"also" seems necessary to me since you have to have both permissions, not just the "edit" permission.

I see no reason to prevent this patch from going through. If someone has the actual phrase that is perfect, then they should specifically put it here and we can go through the review process at that time.

However, at this time I see it as good enough. Someone coming up with an improved way of saying it can go through the review process at that time.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 22: 2678178-22.patch, failed testing.

ftyre76’s picture

Status: Needs work » Needs review
FileSize
2.89 KB

Rebuilt patch.

ftyre76’s picture

FileSize
2.9 KB

Rebuilt patch (without my email this time ... sigh).

ftyre76’s picture

Is there any way to delete 2678178-29.patch ? Thanks.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ftyre76’s picture

Reuploading new patch for 8.3.x

Status: Needs review » Needs work

The last submitted patch, 33: 2678178-33.patch, failed testing.

ftyre76’s picture

Status: Needs work » Needs review
FileSize
2.47 KB

Reuploading new patch for 8.3.x

felribeiro’s picture

Assigned: rajeshwari10 » Unassigned
kiwimind’s picture

Status: Needs review » Needs work

Looks like you might have had some tabs creep in there on line 66. The indentation is incorrect.

Status: Needs review » Needs work

The last submitted patch, 38: node_revision-2678178-38.patch, failed testing.

Thew’s picture

Status: Needs work » Needs review

The patch passed.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Status: Needs review » Reviewed & tested by the community

A usability review was done in #26, and the patch content has not changed since then, noting three points

  • Remove the word 'node'.
  • Concern on the use of 'also'.
  • Make it more scannable.

The word 'node' has been removed. Using 'also' seems necessary as said by @ftyre76. There is no work done on making it more scannable. But even so, the usability review stated that these would not constitute another usability review before commit.

Way back in #23, jhodgdon, was ready to RTBC but after a usability to review. Since that has happened this should be good to go.

Finally, since I don't usually work with permissions I installed the patch and tried it. I found the new text an improvement.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/node/node.permissions.yml
@@ -18,12 +18,13 @@ view own unpublished content:
+  description: 'To view a revision, <em>you also need permission to view the content item.</em>'
...
-  description: 'Role requires permission <em>view revisions</em> and <em>edit rights</em> for nodes in question or <em>administer nodes</em>.'
+  description: 'To revert a revision, <em>you also need permission to edit the content item.</em>'
...
-  description: 'Role requires permission to <em>view revisions</em> and <em>delete rights</em> for nodes in question or <em>administer nodes</em>.'
+  description: 'To delete a revision, <em>you also need permission to delete the content item.</em>'

So it does not really make sense use italics here. The original use of italics was to denote the labels of the permissions used in the UI. Let's remove them now that they are no longer labels.

Thanks!

tameeshb’s picture

Status: Needs work » Needs review
FileSize
1.03 KB
2.45 KB

Removed <em> as per #43

quietone’s picture

Status: Needs review » Reviewed & tested by the community

@tameeshb, thanks for making those fixes.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/node/src/NodePermissions.php
+++ b/core/modules/node/src/NodePermissions.php
@@ -62,14 +62,15 @@ protected function buildPermissions(NodeType $type) {

@@ -62,14 +62,15 @@ protected function buildPermissions(NodeType $type) {
       ),
       "view $type_id revisions" => array(
         'title' => $this->t('%type_name: View revisions', $type_params),
+        'description' => t('To view a revision, <em>you also need permission to view the content item.</em>'),
       ),
       "revert $type_id revisions" => array(
         'title' => $this->t('%type_name: Revert revisions', $type_params),
-        'description' => t('Role requires permission <em>view revisions</em> and <em>edit rights</em> for nodes in question, or <em>administer nodes</em>.'),
+        'description' => t('To revert a revision, <em>you also need permission to edit the content item.</em>'),
       ),
       "delete $type_id revisions" => array(
         'title' => $this->t('%type_name: Delete revisions', $type_params),
-        'description' => $this->t('Role requires permission to <em>view revisions</em> and <em>delete rights</em> for nodes in question, or <em>administer nodes</em>.'),
+        'description' => $this->t('To delete a revision, <em>you also need permission to delete the content item.</em>'),

Still <em> here.

ritzz’s picture

Assigned: Unassigned » ritzz
Status: Needs work » Needs review
FileSize
2.42 KB
1.26 KB

Removed tags.

quietone’s picture

Status: Needs review » Reviewed & tested by the community

Ah, right. I see.

  • xjm committed bad2d57 on 8.4.x
    Issue #2678178 by ftyre76, rajeshwari10, tameeshb, ritzz, dimaro,...
xjm’s picture

Assigned: ritzz » Unassigned
Status: Reviewed & tested by the community » Fixed
Issue tags: -Novice

Alright, this ended up in a good place I think. Thanks everyone! Committed to 8.4.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.