Problem/Motivation

Currently the ability to publish or unpublish a node is locked behind the administer nodes permission. This permission grants access to a lot more than just publishing/unpublishing so is often not granted to editor based roles.

Proposed resolution

Add new permission that grants access to just the status field.

Remaining tasks

All

User interface changes

New administer node published status permission

Introduced terminology

None

API changes

None

Data model changes

None

Release notes snippet

N/A

Issue fork drupal-214190

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

keith.smith’s picture

Version: 6.x-dev » 7.x-dev
Category: bug » feature

This is a very good idea.

But... it seems more like a feature request for 7. As has been often pointed out, it is late in the day for adding new permissions in 6.

jgoldberg’s picture

Yeah, it should probably wait until 7. I do want to emphasize that I still think this is a defect; the ability to publish and promote should not be tied directly to the ability to edit nodes.

webchick’s picture

What if we did an #access property on each of those checkboxes. Then contrib could do whatever it wanted, without adding another 50,000 permissions.

jgoldberg’s picture

Webchick, I'm not sure if I understand what are you are proposing.

webchick’s picture

haha. chalk that up to trying to write a reply just before dinner. :) please disregard.

I misread your description of the patch as you doing an if (user_access('publish nodes')) around the fieldset, rather than an #access property. I see now that you're just changing the permission the #access property checks.

jgoldberg’s picture

Now that a 7.x branch is open, can we reconsider this patch.

catch’s picture

Title: Can't let users publish nodes without also giving them edit priviledges » Publish nodes permission

It's a good idea. There's an issue somewhere to do the same thing for 'sticky' as well, although I can't find it right now.

The node permissions section is getting very long, but we should find a way to deal with that in the ui, and ideally get rid of "administer nodes" entirely since it mainly causes confusion.

jgoldberg’s picture

The node permissions section is getting very long, but we should find a way to deal with that in the ui, and ideally get rid of "administer nodes" entirely since it mainly causes confusion.

I can't agree more. A separate permissions section for nodes would be very nice.

jstoller’s picture

I think this is just one more symptom of the need for a more comprehensive user access system. See this feature request for one idea.

jacobroufa’s picture

As it is, can that patch submitted above be used in D5 or D6? I am not a developer but desparately in need of something like this for a project I'm working on... I can't give users of a certain role Administer Nodes permissions because then they have too much control, but they need to be able to access Unpublished nodes of one nodetype in order to do their job. Unless someone has another idea as to how I might accomplish that? I think the idea behind this patch is a great one and I look forward to seeing it develop into more of a feature in D7

jgoldberg’s picture

@ jacobroufa - You might want to also check out Does an unpublished status mean Draft or Disabled? which I opened along with this ticket. In the mean time, you might want to check out the Views module; you may be able to leverage it if you are trying to pull up lists of unpublished nodes.

jacobroufa’s picture

Using Views to get a list of the unpublished nodes is not the issue though... Allowing someone other than the creator of that node to even see it, let alone edit, review, and publish it is the issue. Even if the person (not creator) trying to view this node has permissions to view, edit, and edit own nodetype, they still can't. Thanks for putting up this patch jgoldberg!

catch’s picture

jacob: if you create a view that doesn't filter by whether a post is published or not (or only shows unpublished nodes) - then any user will be able to read them from the view since it bypasses the access restriction completely - just make it a "full node" view so they can read the whole thing.

jacobroufa’s picture

@catch :

i need to be able to edit the nodes, not just view them. there are very detailed solutions such as nodeaccess or taxonomy access control that will bypass the core access structure. i dont need that level of granularity... just a per nodetype administrative access to view edit and publish unpublished nodes.
thanks for the help!

jacobroufa’s picture

Assigned: Unassigned » jacobroufa
Status: Needs review » Fixed

I installed the patch and it didn't really do anything useful aside from creating an "administer nodes" permission that wasn't called that. Same thing, different name. http://drupal.org/project/publishcontent is a project I've created after hacking around core a bit and deciding that I need to make it a module, not hack core (bad practice). This module, once completed (working on transferring hack to module now and should be out in a week or two) will give another level of permission of "publish content" for each nodetype in the system, in addition to the create, edit, and edit own permissions. This allows a role to view, edit, and publish unpublished nodes of each nodetype selected. First version will be 5.x with 6.x coming out shortly after. I will also propose that this become a part of core in 7.x as per the wish list presented in Dries' State of Drupal address at the beginning of Drupalcon this year.

catch’s picture

Status: Fixed » Active

Putting this back to active, since it looks like the module will be turned into a patch later.

jgoldberg’s picture

Assigned: jacobroufa » Unassigned
Status: Active » Needs review

@ jacobroufa: I'm not sure my patch addresses whatever problem you are having. The main purpose of it is to untie the ability to manage a node's publish status from the ability to administer nodes (edit other users' posts, for example).

robloach’s picture

Status: Needs review » Needs work

Will need reroll with the permission description.

maximago’s picture

Where can we get this one: http://drupal.org/project/publishcontent ?

We really need this module in this scenario:
We have several installations. Some posts are transfered from one system to others with feedAPI. On the receiving platform, the authors should not edit the posts, put unpublish them.
So, this module is really a fantastic idea!
DG, maximago.de

K4m1K4tz3’s picture

This project sounds interesting. I would like to use "publishcontent" on my Drupal 6 installation. So what is the status of this project?

jgoldberg’s picture

Status: Needs work » Needs review
StatusFileSize
new1.53 KB

Rerolled a patch that meets the 7.x permission guidelines.

Mez’s picture

StatusFileSize
new3.05 KB

This patch just changes the option for all publishing options to a new permission.

The following patch (against drupal 6.2) gives more granular control (only over publishing items - as this is all I needed to add permissions for)

cburschka’s picture

#282122: D7UX: "Save draft" and "Publish" buttons on node forms is (kind of) dependent on this patch.

Mez: If you want your patch to be considered, you must submit it against D7. Features are not added to the stable version.

Anonymous’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

David_Rothstein’s picture

Subscribing (and bumping)... I've been wondering lately about the fact that as of D6 we have granular "delete" permissions in Drupal but not granular "publish/unpublish" permissions. It seems like the latter would often be more useful.

shark’s picture

Subscribing.

mabgfounder’s picture

subscribing

webchick’s picture

Version: 7.x-dev » 8.x-dev

This sounds useful, but too late for Drupal 7.

cpall’s picture

I need this as well!

subscribing

dmusicstud’s picture

Subscribing - also would like this functionality

Alan.Guggenheim’s picture

Yes, we need this.

YK85’s picture

subscribing - it would be great to see this in core.

I have found the Publish Content (http://drupal.org/project/publishcontent) module in D6 that allows:

"publish *all* content": you can publish any node
"publish 'nodetype' content": you can publish any node whose type is 'nodetype'
"unpublish *all* content": you can unpublish any node
"publish 'nodetype' content": you can publish any node whose type is 'nodetype'

If someone could kindly port it to Drupal 7 then it would allow this functionality until it is implemented in D8?

stefan vaduva’s picture

Status: Needs work » Needs review

#22: publish_own.diff queued for re-testing.

druppeler’s picture

Subscribing....

ludo.r’s picture

This feature wont be available in D7???

In most projects, i need the users to be able to publish/unpublish a content, this means giving "administer nodes" permission.
Not only this gives node options that the user doesnt need and even doesnt understand (revisions, menu settings, authoring etc...), but sometimes, when some users should only manage their own content, they have full access to all nodes.

I think this feature should be included in Drupal core as soon as possible, so we wont need to find solutions with extra modules or custom code for each project configuration. This is always a tricky issue to resolve!

Subscribing!

geve’s picture

Priority: Normal » Major

I dont understand why this wasnt fixed in D7 itself. Need to have this in D8 surely.

Is it possible to get this small patch in D7?

Status: Needs review » Needs work

The last submitted patch, publish_own.diff, failed testing.

RussT’s picture

Subscribe

shp’s picture

Subscribe...

awm’s picture

Subscribe

David_Rothstein’s picture

Priority: Major » Normal
Status: Needs work » Needs review
StatusFileSize
new3.45 KB

The reason this wasn't fixed in D7 is that not enough people worked on reviewing and testing it to get it in. It doesn't happen by magic.

This also isn't a major issue - especially when the feature is easy to add via a contrib module.

Anyway, here is a reroll of the patch for Drupal 8.

It sounds like we actually have two options being discussed here: a single "publish nodes" permission (i.e., the original patch in this issue), or a granular set of permissions ("publish own X content", "publish any X content").

I think the second makes a lot of sense, especially since we have granular delete permissions already, and the use case of, e.g., allowing someone to unpublish forum posts but not allowing them to unpublish very important things like the front page of the website is a strong one (though at least in the core interface you can only unpublish things you're also able to edit, so that use case is partially met regardless). However, adding 'publish' as a major option to the core node access system (on the level of the existing CRUD permissions) kind of seems like a big step, especially because there are a lot of people who find the core published/unpublished flag too limiting and want to completely ignore or bypass it.

So for now, I went with a reroll of the simpler, original patch from #21. I added a D7->D8 update function, and also made it so the permission only allows you to control the published status; having it also allow you to control "sticky" and "promoted to front page" just seemed too weird to me (and perhaps I'm anticipating #1123696: Does 'Save' publish my content? which will hopefully break up the publishing options fieldset so the published status is configured separately from those other settings).

Status: Needs review » Needs work

The last submitted patch, publish-nodes-214190-41.patch, failed testing.

David_Rothstein’s picture

Status: Needs work » Needs review
StatusFileSize
new5.81 KB
yoroy’s picture

Issue tags: +permissions

tagging

theamoeba’s picture

I tried to run the patch in #43 but the file structure of drupal 8 has changed.

Here is the error message outut I am getting:

theamoeba@~/development/drupal8> git apply -v publish-nodes-214190-43.patch
Checking patch modules/node/node.install...
error: modules/node/node.install: No such file or directory
Checking patch modules/node/node.js...
error: modules/node/node.js: No such file or directory
Checking patch modules/node/node.module...
error: modules/node/node.module: No such file or directory
Checking patch modules/node/node.pages.inc...
error: modules/node/node.pages.inc: No such file or directory
Checking patch modules/node/node.test...
error: modules/node/node.test: No such file or directory
Checking patch modules/translation/translation.test...
error: modules/translation/translation.test: No such file or directory
Checking patch modules/trigger/trigger.test...
error: modules/trigger/trigger.test: No such file or directory

I have altered the patch and it applies just fine. The new permission seems to work as well.

theamoeba’s picture

StatusFileSize
new5.95 KB

I forgot to attach the altered patch in #45.

theamoeba’s picture

StatusFileSize
new12.32 KB
new9.53 KB

I have tested the patch and everything is working. I do not see the publish to front page toggle though. The user can now publish and unpublish content.

The new permission:
Permission

The option on the node add and edit page:
Node option

Status: Needs review » Needs work
Issue tags: -permissions

The last submitted patch, publish-nodes-214190-46.patch, failed testing.

guedressel’s picture

Please consider creating a defaultAccess() implementation for the base field "status" of node, if you want to create such a new permission. (Issue #2098355: Missing default access for all node fields).

I would love to see these permissions in d8 core.
I would also split the "(un)publish 'nodetype' content" permissions into "(un)publish own 'nodetype' content" and "(un)publish any 'nodetype' content".

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

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

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

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

geek-merlin’s picture

ressa’s picture

This would still be a great feature to add to Drupal 8. Thanks @axel.rutz for sharing the Override Node Options module as an alternative solution.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

mxr576’s picture

bump :) Override node options saved the day... but it would be great if core would not handle this "administrative fields" as special ones and it would provide a way to grant access to those with granular permissions.

hikkypo’s picture

Right now this issue is so outdated that it is hard for me to see if this is asking for the functionality of the administer content permission. But it does seem like that. (also see https://www.drupal.org/project/drupal/issues/2842960).

This would mean that either this issue is outdated and can be closed. Or this still needs steps to separate the separate permissions. Meaning you can toggle publication separately from other options like promote to front page.

For anyone looking to allow the publication of pages for specific roles the 'administer content' permission seems to be the way to go.

berdir’s picture

The point of this issue is to have a dedicated permission just for that. administer content also allows to change the author, promote/sticky flags and other things that you might not want to allow.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

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

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should 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: 9.5.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. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

acbramley’s picture

Status: Needs work » Postponed (maintainer needs more info)

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.

dww’s picture

Status: Postponed (maintainer needs more info) » Needs work

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.

dww’s picture

Just marked #2798601: Add dedicated permission for toggling content published status 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

acbramley’s picture

@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 :)

acbramley’s picture

Title: Publish nodes permission » Add permission for (un)publishing nodes
Issue summary: View changes
Issue tags: -permissions

acbramley’s picture

Status: Needs work » Needs review

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

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

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!

acbramley’s picture

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).

acbramley’s picture

Status: Needs work » Needs review

Ready to go now

smustgrave’s picture

Won't this need an upgrade path

acbramley’s picture

@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.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

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

catch’s picture

Status: Reviewed & tested by the community » Needs review

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.

acbramley’s picture

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.

smustgrave’s picture

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.

gábor hojtsy’s picture

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.

catch’s picture

Status: Needs review » Needs work

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

dww’s picture

acbramley’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Feedback appears to be addressed for this one.

quietone’s picture

Status: Reviewed & tested by the community » Needs work

I scanned the comments and didn't find any unanswered questions or remaining work. I read the MR and left a suggestion to improve a message. I also updated credit.

quietone’s picture

Status: Needs work » Reviewed & tested by the community

Back to RTBC

quietone’s picture

Title: Add permission for (un)publishing nodes » Add administer node published status permission
alexpott’s picture

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

alexpott’s picture

Status: Needs work » Reviewed & tested by the community

@needs-review-queue-bot you are wrong!

alexpott’s picture

I discussed this issue with @berdir and we agreed that leaving the "administer nodes" permission as an OR is a good thing here because

I didn't really look at the code in the status issue yet, but I think one important difference between those two issues is their impact. one is a route permission on a rarely used form, that's going to be very rarely customized/integrated/tested/... the other is field access on node status. tons of tests, default config and other things are going to be impacted by it, so not dropping the administer nodes permission yet I think is a good thing

We were thinking about the differences in approach between this issue and #3418353: Add new permission for rebuild permissions form

alexpott’s picture

I creditted @ifrik and @sidgrafix from the duplicate issue #2798601: Add dedicated permission for toggling content published status

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 54e0120 and pushed to 11.x. Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • alexpott committed 54e0120b on 11.x
    Issue #214190 by jgoldberg, webchick, catch, jacobroufa, Mez,...

acbramley’s picture

Issue summary: View changes

Great to see this get in, thank you! Update the permission name in the CR and IS.

Status: Fixed » Closed (fixed)

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

gábor hojtsy’s picture