Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs around Drupal permissions for Preview Mode #584

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

tjheffner
Copy link

@tjheffner tjheffner commented Nov 2, 2023

Update docs around Drupal permissions.

This pull request is for: (mark with an "x")

  • examples/*
  • modules/next
  • packages/next-drupal
  • starters/basic-starter
  • starters/graphql-starter
  • Other

GitHub Issue: #589

https://drupal.slack.com/archives/C01E36BMU72/p1698865058084659

Describe your changes

Docs update, preview user shouldn't require administrator access.

Update docs around Drupal permissions
Copy link

vercel bot commented Nov 2, 2023

@tjheffner is attempting to deploy a commit to the Chapter Three Team on Vercel.

A member of the Team first needs to authorize it.

- Bypass content access control
- Issue subrequests
- View user information

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests run eslint and prettier format checks against the code base. And the tests are failing because you've accidentally added an extra blank line to this mdx file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I was just editing through the web ui and didn't notice. Hopefully resolved now!

@JohnAlbin
Copy link
Collaborator

Oh sorry, I was just editing through the web ui and didn't notice. Hopefully resolved now!

Perfect! And good catch on noticing the additional Bypass content access control docs that needed updating.

The tests are failing now. But they aren't because of this PR. I'll fix them and then merge this PR. Thanks!

Copy link

vercel bot commented Nov 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-drupal ❌ Failed (Inspect) Nov 22, 2023 4:39pm

- 'view all revisions'
- 'view any unpublished content'
- 'view latest version'
- 'view media'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried out these new permissions on a Drupal 10.1 site and ran into a snag.

What version of Drupal did you use to create this list?

In Drupal 10.1 some of those permissions don't exist. Best I can tell the permissions are:

  • 'View all media revisions'
  • 'View media'
  • 'View own unpublished media'
  • 'View all revisions'
  • 'View published content'
  • 'View own unpublished content'
  • 'Issue subrequests'
  • 'View user information'

What heading is "view latest version" under? I don't see anything in 10.1 that matches that.

Copy link
Author

@tjheffner tjheffner Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were from a Drupal 9.5.11 site.

On our site, view latest version is underneath the Content Moderation heading, and was required for viewing forward revisions (i.e. new draft revision of previously published content) in our setup

Screenshot 2023-11-29 at 10 14 27 AM

Also, the preview user will likely still want view any unpublished content, not necessarily just their own

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On our site, view latest version is underneath the Content Moderation heading

Aha! I didn't have that installed. That module is also required for the "View any unpublished content" permission. Without that module, the only perms that mention "unpublished" are the ones under the "Node"/"Media" modules for "own unpublished".

And, yes, having the "View any unpublished content" permission is required to allow the Next.js User to view unpublished content owned by regular content editors.

I think we should add the module heading for each of these permission so that users (like me!) don't get confused about which permissions to use. Adding the module heading will also give a hint on how to get that permission if it isn't listed on a user's website.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm… I still don't see a 'access content' permission even on a Drupal 9 site. I'm using Node module's 'View published content' permission instead.

I've tested these permissions on a Drupal 10.1 site and they seem to be sufficient:

- 'Content Moderation: View any unpublished content'
- 'Content Moderation: View the latest version'
- 'Media: View all media revisions'
- 'Media: View media'
- 'Node: View all revisions'
- 'Node: View published content'
- 'Subrequests: Issue subrequests'
- 'User: View user information'

Copy link
Author

@tjheffner tjheffner Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think some of the confusion is my list is coming from the exported config (uses machine names of perms), and the permissions list in the UI doesn't surface those, using the titles instead.

access content is originally coming from Core's system.permissions.yml, and is equivalent to View published content

# Note that the 'access content' permission is moved to the Node section of the
# permission form when the Node module is enabled.
access content:
  title: 'View published content'

- 'view all revisions'
- 'view any unpublished content'
- 'view latest version'
- 'view media'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm… I still don't see a 'access content' permission even on a Drupal 9 site. I'm using Node module's 'View published content' permission instead.

I've tested these permissions on a Drupal 10.1 site and they seem to be sufficient:

- 'Content Moderation: View any unpublished content'
- 'Content Moderation: View the latest version'
- 'Media: View all media revisions'
- 'Media: View media'
- 'Node: View all revisions'
- 'Node: View published content'
- 'Subrequests: Issue subrequests'
- 'User: View user information'

@tjheffner
Copy link
Author

Is the requested change just asking that we use the readable names instead of the machine names exported in the config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants