Publish nodes permission

Created on 25 January 2008, over 17 years ago
Updated 19 March 2025, 5 months ago

In our instance of Drupal, we allow authenticated users to publish to the front page. The only way to give users this privilege is to give them access to the "administer nodes" permission:

  $form['options'] = array(
    '#type' => 'fieldset',
    '#access' => user_access('administer nodes'),
    '#title' => t('Publishing options'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 25,
  );
...

However, because of the way node_access is implemented, having the "administer nodes" privilege gives you full access to all node operations, including editing other users nodes:

function node_access($op, $node, $account = NULL) {
...
  if (user_access('administer nodes', $account)) {
    return TRUE;
  }

The patch included creates a new permission, "publish nodes," which allows an admin to select which groups should be able to publish nodes, thus separating the privilege from the ability to administer nodes.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

node system

Created by

πŸ‡ΊπŸ‡ΈUnited States jgoldberg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Is this still something that core needs to support? We have 2 well maintained modules mentioned here https://www.drupal.org/project/override_node_options β†’ and https://www.drupal.org/project/publishcontent β†’

    Core also provides content moderation for much finer control over publishing workflows and permissions.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    IMHO, yes, this is something core should do. Reading the comments, we've got "yes this is a good idea" from all sorts of folks who are either past or current release managers, product managers, etc. It's fairly absurd that we have granular permissions for delete, but not publish/unpublish. Yes, content moderation provides more advanced publishing workflows. But for something so fundamental to a content management system as publish status, I think core needs to solve this.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    Just marked πŸ› Users can edit/delete content but not unpublish it Active duplicate with this, which had 35 followers.
    I imagine there are other duplicates lurking in the issue queue for this.
    This is a very common need. Further evidence core should provide this out of the box.

    Thanks!
    -Derek

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    @dww no worries! Lots of these very old issues have those types of comments that have since gone stale so I'm asking the question as of 2025 with all our new tools :)

  • Status changed to Needs work 2 months ago
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Failed
    2 months ago
    Total: 589s
    #514691
  • Pipeline finished with Success
    2 months ago
    Total: 434s
    #514714
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Ready for a review, happy to change any of the text around the permission (name/description)

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Left a suggestion for a title/description update.

    But what would the workflow be if you have access to edit a node but can't change the status? Would it just resave the current status?

    If you are another contributor eager to jump in, please allow the previous poster(s) at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    But what would the workflow be if you have access to edit a node but can't change the status? Would it just resave the current status?

    It would be the exact same as it currently is for a user without administer nodes (stays in the same status).

  • Pipeline finished with Success
    about 2 months ago
    Total: 395s
    #526626
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Ready to go now

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Won't this need an upgrade path

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    @smustgrave no because we aren't changing existing functionality, just adding the ability for users to be granted a new permission to change the status.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    I see then everything seems to be working as expected.
    Tested with the editor role from the standard install.

    Think all feedback has been addressed

  • πŸ‡¬πŸ‡§United Kingdom catch

    Couple of questions:

    1. Do we refer to this field as 'status' anywhere else in the UI or is it always 'Published/Unpublished' - or to put it differently, should the the permission be something like 'administer node published status'.

    2. Is there any desire to add this as a generic permission for all entities? I guess we're pretty far from being able to do that.

    3. Is there any consideration for content_moderation or workspaces module where workflow changes can result in an entity being published? I think the answer to this is probably no, because they already do what they do with their own permissions, but just in case.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    1. I don't think so via the UI, I'm not fussed if we want to change it
    2. That'd be nice, but then we have BC concerns as we'd have to implement a generic field access hook for anything with a status key, etc.
    3. CM hides the status field, I'm not sure about workspaces.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Can chalk this up to site configuration but I tested this on a project today. The content type has published default to checked. I applied this patch so that certain editors can't publish the page, but since the default is published it still saved as such. All the editor can't do now is unpublish it.

  • πŸ‡­πŸ‡ΊHungary GΓ‘bor Hojtsy Hungary

    As a Drupal core product manager, I agree this would be a generally good feature to have. 'Administer node published status' sounds like a better name indeed.

  • πŸ‡¬πŸ‡§United Kingdom catch

    Let's go for 'administer node published status' given #86.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    Adding πŸ› Support "View any unpublished [entity_type]" and "Administer [entity_type]" permissions Postponed as related, which itself has a bunch of related issues that are relevant here.

  • πŸ‡¦πŸ‡ΊAustralia acbramley
  • Pipeline finished with Success
    16 days ago
    Total: 1076s
    #561962
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Feedback appears to be addressed for this one.

Production build 0.71.5 2024