Hi Rik,
I have been having so much fun trying out your modules and their possibilities! Here is the problem I have run into. I want to allow key supporters to have a portion of the site into which they can add their own pages, and I will use a node type to distinguish the pages they are allowed to create. I want them to see their own pages, of course, and be able to publish, revert, etc for their own work, but not for others or other types of pages.
I am not sure whether this suggestion belongs here or in revisioning, but it seems that once module_grants is installed, a user with "access content summary" can see unpublished nodes by other users. If, in revisioning, publish is then ticked, it applies to any content the user can see. What we need in Module_grants, I think, is an additional permission: "access non-owner content". Whether there is one of these per node type, or only one for all node types, I don't know (though I suspect per node would be good), but the idea is that if this is ticked, the user can view unpublished content by others, if not, not. The problem being overcome is that the standard drupal node permissions cover all cases except plain old viewing. Viewing, it assumes, is controlled solely by being published or not. So when module_grants opens up unpublished content to users with the "access content summary" permission, it cannot at present distinguish between users who are to be allowed to oversee all unpublished content, or those who may see only their own.
I hope that makes sense. Many thanks again for such great modules!
Ron.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | module_grants.module-unpublished-access-for-2.7.patch | 1.9 KB | rhouse |
| #14 | module_grants.module-unpublished-access.patch | 1.49 KB | rhouse |
| #5 | module_grants.module-unpublished-access.patch | 1.55 KB | rhouse |
Comments
Comment #1
Anonymous (not verified) commentedHi Ron
Interesting thoughts. I also have trouble deciding which module this all belongs under. I have even wondered if the two would better reside together as one package, with the user only activating what they need. For the last couple of days Rik has been making great progress, but i wonder if there is need of a review what is needed?
ie.
who - roles and needs of each role
what - what they can do see etc
Also other restictions if needed defined by admin
and what other modules may impact on what we do
These are probably only some points
John
Comment #2
rdeboer"If, in revisioning, publish is then ticked, it applies to any content the user can see."
Hi Ron,
I'm not sure I fully understand exactly what you're after, but it looks like part of what you need is very much the feature that midkemia has been slapping me in the face with over the last couple of weeks, until I gave in.... :-)
It is now available in the development versions of Module Grants + Revisioning (just needs it a couple of issues ironed out, thanks to John's relentless testing!). What it does is restricting the publish/unpublish permission to only those content types for which "New revisions in draft, pending moderation" has been ticked on the Content management>>Content types>>edit page. So in your case that would be the content type you've created for these key supporters.
With that in place, what part of your use-case remains unimplemented?
"it seems that once module_grants is installed, a user with "access content summary" can see unpublished nodes by other users"
More precisely, this is the case only when "view revisions" is ticked for the role(s) in question.
So, if I understand you correctly, you want to first block people viewing unpublished content, but then grant that viewing access per content type.
The way Module Grants initially intended to do this was by delegating to another content access module for this, one that manipulates the
node_accessdb table, which allows you to specify more fine-grained content access grants for 'delete', 'update' AND 'view' on a per node/node-type basis.TAC-Lite is such a module. The Revisioning tutorial for categorised content may give you some ideas. I think you should be able to assign a term (like "restricted") to your content type and then set up access grants that allow only certain roles to view content featuring that term.
Comment #3
rhouse commentedHi Rik and John, thanks for trying to make sense of my prior long-windedness.
I feel guilty putting in feature requests when Rik has worked so tirelessly to give us what is already fantastic stuff. I am wary of activating other modules. I tried out nodeaccess, and it required permissions to be rebuilt; but it seems that on huge sites this operation uses ever-increasing memory and therefore fails, so I took that module out before I got bitten! I don't know if this (rather serious!) problem also exists for TAC-lite. If we can make Rik's hot stuff do the job, I would be more than happy.
Standard drupal has a curious hole in the permission system. All manner of edit, delete, create, permissions exist per content type, but not 'view'! View comes either by being an excessively powerful user, being the creator, or the work's being published. So very coarse-toothed a comb I almost cannot believe it. It seems the basic drupal view permission is: anything, unless unpublished. So when module_grants opens up unpublished works, view anything comes along automatically. I think that is the central problem.
I am not sure whether John's request will solve the problem. Basically, a site I am developing for a nonprofit society has some other societies supporting it, and the others are to be given their own group of pages on the site. Since there are two, and maybe more, and these are independent, I will need to set up two node types and I can set create own, edit own, etc permissions so that each of the two supporters can develop their own pages. At least one page, the 'home' page for each supporter, will be created by me and owned by me for them to edit and insert their links into directing to their own new pages. But if I am following you, if I set "New revisions in draft, pending moderation" for the two content types, both supporters will be able to see all pages of both, rather than just their own. The reason it is limiting is, I suspect, that it attacks the problem from the point of view of the target node type, but the solution needed is from the point of view of the specific author's permissions. Rather than say "This node type can only be seen if..." I think it needs "This role can only see these node types." That would allow some other role to be given greater rights. Since only one small thing (specifying rights for viewing when unpublished) is missing from drupal in order to make it all work properly, I wondered if this kind of thing is hard or easy to get in there? Manipulating the node_access table is obviously a very dangerous thing to have a site rely on.
As I write this now, it occurs to me that another (perhaps simpler) way to get the required effect would be a "Can only view unpublished if can edit" anti-permission, since edit permissions can be allocated acceptably with standard permissions, and the need to see unpublished might be expected to go with edit rights, if they are restricted at all. Expressed in positive language, that would be "Can view unpublished even if cannot edit" - which is the way I understand permissions to work. Users without that would only see what they can edit; the site owner would have it and therefore be able to see all unpublished content.
Apologies for finding this hard to explain!
Thanks again Rik, cheers!
Ron.
Comment #4
rdeboerLots to think about Ron!
Will get back to you.
Rik
Comment #5
rhouse commentedThanks Rik,
I have had a go at implementing the suggestion of this feature request, by introducing a per-nodetype permission for accessing unpublished content. (I just noticed you checked in some more changes since I collected the HEAD and started hacking, so I hope I am not at too many cross purposes.)
My changes add these permissions:
Under module_grants module:
Then it changes the rule for granting access as follows. Change:
To:
Rationale: The new rule is saying: "If the node is NOT published and user does not have the "unpublished xxx access" permission, deny access, UNLESS it's the author (viewing their only revision OR possessing "view revisions" permission)"
So a user withOUT "unpublished xxx access" cannot see any but their own work, in which case "view revisions" is used to test whether they can see multiple revisions; but a user WITH "unpublished xxx access" can see all unpublished for which they pass other tests. This effectively grants a "view revisions"-style permission in that restricted set. One might consider whether "view revisions" should be required anyway in that case if more than one revision exists.
I am still working on this, and I'll post again, but I wanted to give you a progress report.
Ron.
Comment #6
rhouse commentedHi again Rik,
I have checked out my changes above, and AFAICT, they are doing what they are designed to do. There is only one missing distinction: In my scenario, I can get the special user to be able to publish and unpublish their own type of page, but that also includes the special page which the site owner sets up for them to edit, which is a problem. With a bit more struggling, I think I could get that to work too, but I wonder if there comes a point when the benefit isn't worth the complexity. For now I'll leave it as-is and test it out a bit more.
Ron.
Comment #7
rdeboerThanks Ron,
I will look into your solution in more detail, just don't have much time on top of my regular 9-5...
Rik
Comment #8
rhouse commentedThanks Rik,
I think it demonstrates what a well-designed and conceived module it is, that such a change and extra function can be made with relatively little pain.
Cheers,
Ron.
Comment #9
wickwood commentedIf I'm understanding this thread correctly, the issue at hand is how to prevent authors from viewing unpublished content created by other authors unless they have moderation privileges, but still be able to view their own unpublished content, correct?
If it is, that is exactly what I'm looking for!
I just installed your patch, Ron, and based on my testing I think you solved my latest problem!
Steve
Comment #10
wickwood commentedHello Again Ron,
After doing some more testing, I realized this patch does not address the all possible content types on a website.
Missing are blog, forum, poll, and image types from my site.
At first I thought this was a function of node_get_types() because each of these for some reason have special treatment in Drupal.
But then I realized it was your patch that was filtering them out. By removing the if-then statement, I was presented with an entire list of all the content-types to assign the 'unpublished content_type access' permission.
Any particular reason that you filtered out anything that doesn't return from node_get_types() as a type = node.
Back to the testing, and thanks again for the patch!
Steve
Comment #11
rhouse commentedHi Steve,
Thanks for giving the patch a run-over. Yes, the reason I put in that if statement was that I copied the code from node.module that produces the list of permissions like "delete own xxx content" etc. I'm flying by the seat of my pants here, having fun but basically being clueless. Now if we take out that if statement, the next question is: why does node.module have it? Why aren't there permissions available in the core for doing stuff to blog, forum, etc? How does the system know who is entitled to do stuff to that stuff? I have this awful feeling that I don't understand something very important - unless I copied the wrong loop by mistake!
Looking forward to your insights!
Ron.
Comment #12
rdeboerSteve, Ron,
I'm following your considerations and debate with great interest.
Have no time to verify or contribute much right now, as I'm flat out with #492414: Tab stickiness (remember tab selection) at the moment.
Keep up the good work, though, you won't get forgotten!
Rik
Comment #13
wickwood commentedHello Ron,
Your welcome, and completely understand where you are coming from. Drupal seems to be the CMS you never stop learning about how it really works!
I'm guessing here that the reason that 'if statement' is in the node module is because the other core content-types have their own permissions sections and this allows them to separate them out. Other than that I don't know of any other reason to do it.
Thanks again for making the patch. So far it's working well for me.
Steve
Comment #14
rhouse commentedHi Steve,
Yes, that sounds right... Checking another website of mine, I see that you are correct - blog has a separate section, and if its permissions had also appeared under node, they would have been duplicated. So the if statement is superfluous. Here is a modified patch.
Ron.
Comment #15
rdeboerSorry guys... Haven't forgotten about this patch, just have little time and the module is currently in a state of flux on my laptop. Will attend to it soon.
Rik
Comment #16
rdeboerRe: #14
Hi Ron,
Long time no see...
I was wondering to what extent you feel there's an overlap between this feature/patch and the recently implemented "View revisions of own content" permission: #513078: Flexible revision permissions. ?
Rik
Comment #17
rhouse commentedHi Rik,
Thanks for all your hard work lately! I haven't actually downloaded the latest version because what I now have is doing fine - and you know what they say about sleeping dogs... So I haven't tried this new feature, but from what I read, it sounds as if the two are slicing things in perpendicular directions. The new feature is implementing a distinction between own and any, but my patch implements a distinction between node types. If I understand it properly, they should not interfere and they both serve someone's purposes. If I get some free time I'll put the latest version on my local test site and see what I can see.
Cheers,
Ron.
Comment #18
rdeboerOk, will leave it to be revisited.
Comment #19
rhouse commentedHi Rik,
I have finally tested your 2.7 (looks really nice, thank you!). I have added my unpublished access patch, and it does indeed operate orthogonally to the other features you have added to 2.7. Although my site is reasonably simple, I get all the expected behaviour. The patch in the earlier comment #14 won't work, though, because you have made so many under-the-hood changes. Here is the same patch made against version 2.7. I believe Steve is using this patch too - I hope it is working out okay.
Cheers,
Ron.
Comment #20
rhouse commentedOops, In the previous comment I actually mean version 2.6. Don't know why 2.7 is floating around in my head. Sorry!
Comment #21
rdeboerThanks for the updated patch Ron! I hope to reserve some time to update to latest and greatest, soon.
Rik
Comment #22
rdeboerSo if I understand the proposed patch correctly, this is really a collection of 'view anyone's unpublished content' permissions, qualified by content type rather than by ownership.
E.g. it's a 'view revisions of anyone's unpublished story (or page or blog...) content' as opposed to 'view revisions of any content I created'.
It adds complexity and possibly confusion and I'm wondering whether in most use case scenario's the recent 'view revisions of own content' permission can be used instead?
Comment #23
rhouse commentedSorry I've been sidetracked for a while, and didn't see your reply.
I don't know what to say in reply to your comment about complexity and confusion. It doesn't confuse me: Drupal supplies options for everything except view unpublished, so this supplies it. The wording of what it does is self-explanatory and it completes the so-far inconsistently unfinished set of possibilities. I don't know how that is confusing. Steve said above he is using it too. Since there are only a handful of people actively contributing here, if two of them find something to be just what they want, presumably it is of more than marginal use?
And no, view revisions of own... doesn't cut the mustard. My case is that I want certain trusted users to see all unpublished stories so they can plan their own work to fit in. View own is simply wrong for the purpose. Or if it can be used, please tell me how to do it, because it certainly baffles me.
The basic motivation behind my wanting to make this module complete even if it means not quite so simple is that I don't want to implement any of those modules that change node permissions. I have read of many horror stories of the permission recalculator failing to complete and leaving sites broken. If we can do this with conditional logic that is simply tested per access, it avoids a huge danger to robustness.
Comment #24
rdeboerMaybe we're doubling up... See project View Unpublished
Also: #606516: View own unpublished content and respect module_grants
Comment #25
rhouse commentedI looked at View Unpublished and it confused me. The instructions say to install Override Node Options as well, which allows selected roles to publish or unpublish. While that might be nice, I don't need it and I don't see why a view module should require it. But when I go through the View... code, I cannot see anywhere how it actually makes nodes viewable. (Your code Rik, despite being so much bigger, makes sense to me.) So maybe it is relying on something in Override... after all? It feels very disquieting, as well as making me wonder how these modules will interact. I have tried to stick with just your modules for that reason - no unforeseen interaction troubles.
Comment #26
rdeboerI have modified
function module_grants_node_access(..)slightly.As a result the functionality represented by the proposed unpublished <content type> access family of permissions in RTH's patch (#19) is now available through Revisioning's view revisions of any <content type> content permission(s).
That is: with this permission ticked the role may access both published and unpublished content of the type in question to the extent that other contributing content access modules (if any) allow it. If there aren't any content access modules in play, then access normally defaults to view access only (via the node_access table).
Install versions of Module Grants and Revisioning of 16-Dec-09 or later and make sure that the view revisions permission at User management >> Permissions section "node module", is UNticked for this role, because view revisions applies to ALL types, rather than just a particular type.
Also make sure that the anonymous user does NOT have the view revisions permission, nor any of Revisioning's view revisions of any|own <content type> content permissions, as this would allow the general public to view yet to be published as well as previously published (archived) content.
Comment #27
rhouse commentedThanks Rik, that looks interesting. I'll give it a go on my local copy. I'll let you know how it goes.