Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It would be nice to have a views filter which says "ACL: current user has persmissions to:
READ|WRITE|DELETE" and you could multiple select... :)
Comment | File | Size | Author |
---|---|---|---|
#14 | acl-views-filters-339899-14.patch | 4 KB | Allan Walker |
#13 | acl-views-filters-339899-13.patch | 4.03 KB | Allan Walker |
#11 | acl.zip | 25.81 KB | Allan Walker |
#9 | acl-views_filter-339899-9.patch | 4.9 KB | ckng |
#4 | acl-views-filters.patch | 4.05 KB | mr.andrey |
Comments
Comment #1
salvisSorry, this is about as specific as "it would be nice if the sun were shining." I can't do anything with this.
Look at devel_node_access in debug mode. If you still think some must-have information is missing, then reopen and be more specific.
Comment #2
mr.andrey CreditAttribution: mr.andrey commentedHey, the sun is shining!
Here is the "patch" to provide view/update/delete views filters (see under Node).
(Sorry, I don't know how to do multi-file patches, so this is copy/paste + tar.gz)
In acl.module, add this:
Then unzip the attached .tar.gz file in acl (it will create "includes" directory with the necessary views files).
The reason why I wrote this is because we have a setup where a node that has general view permission is different than a node that has explicit ACL permission, and it's important for us to show them separately.
Tutorial on how to write a Views filter
Best,
Andrey.
Comment #3
salvisWell, how about that! Thanks for sharing this!
Sorry, this puts it into the do-later pile...
Multi-file patches are easy: just diff directories:
Comment #4
mr.andrey CreditAttribution: mr.andrey commentedHere's the actual patch. And just for reference, here's the command for creating recursive multi-file/folder patches:
Comment #5
salvisAh, -uprN — thanks!
Dreditor reports a number of white space issues:
Many of the files end without a newline. This may confuse patch — in the code repository I end up with
and I'm unable to undo the patch. In a test installation, where the acl directory looks identical, patch can't match the acl.module file at all. Maybe this is also related to confusion about the acl.ori directory — can you try
i.e. branch the directory structure one level higher so that both directories are called 'acl'?
You have a lots of lines that start with tabs as well as lines that have only a tab or space on them.
Please remove these, they're unnecessary.
The other three new files also have tab and space issues.
Can you set your editor to never use tabs and to remove trailing white space? Or make white space visible? This will avoid endless trouble with the Drupal coding guidelines as well as Dreditor and Coder.
Just so I get this right: What will I be able to do once I can apply the patch? Create a node list that shows only the nodes where the current user has, say, Delete permission through ACL, right?
Is there any chance that you'll port this to D7 anytime soon?
Comment #6
mr.andrey CreditAttribution: mr.andrey commentedIs there an easy way to do this tab fix in Dreamweaver?
That's right.
I don't use D7 on any of my sites, so probably not.
Best,
Andrey.
Comment #7
torgosPizzaSubscribing. I'm in the process of creating a "User portal" where each "subscriber" has a View of all of the content they've signed up for. Views integration is exactly what we need. So thanks for the patch, I'll be checking it out.
Comment #8
jonaswouters CreditAttribution: jonaswouters commentedsubscribing
Comment #9
ckngShould probably patch for D7 first, but have urgent need on D6.
This should be straight forward to port.
This is based on @mr.andrey patch in #4
- Fixed coder formatting
- Fixed update filter class name
Comment #10
salvisThank you for the updated patch, but...
Yes. We can't commit new features to D6 and risk forcing a downgrade on upgrade to D7.
I'm leaving this as NR — testing and reviews are welcome — but I need to see a D7 version first.
Comment #11
Allan Walker CreditAttribution: Allan Walker as a volunteer commentedI have started trying to port the changes from this patch to Drupal 7 and Views 3. It's my first time trying to do such a thing so I'm not sure if I've done it right.
I've attached the full module that I'm working on, as I'm not too sure how to create a patch from the changes I've made. Anyway, I have managed to get the views filter handlers coming up as a filter in views. I can apply the filter, but then this error appears:
The sql is pretty much straight from what was supplied above, so I'm assuming it's some sort of D6 to D7 issue, but I haven't had any luck getting to the bottom of it in google. Here is the query:
Any suggestions would be greatly appreciated.
Comment #12
salvisYou are passing the numeric uid of the current user in the place of
***CURRENT_USER***
, right?However, as I wrote in #10, all development has to go to the current version first, which is now D8.
I think your chances for getting feedback would be better with a patch than a zip file. You can create a directory 'contrib' in the 'acl' directory and a directory for your module inside that, and then create a patch from the 'acl' directory.
Comment #13
Allan Walker CreditAttribution: Allan Walker as a volunteer commentedThanks for your reply Salvis, and thanks for the tips about creating a patch
I have managed to get this working now, I changed the function to add_where_expression() and it works perfectly. I will work on a D8 patch once I get my head around it, but here is one for D7
Comment #14
Allan Walker CreditAttribution: Allan Walker as a volunteer commentedWhoops, I included a debugging line by mistake, I've removed it in this patch
Comment #15
joegl CreditAttribution: joegl commentedAllan, what version of the D7 module is the patch in #14 for? I keep getting rejected hunks and a malformed error (at line #141). I have version 7.x-1.1 of the module. Thanks!
Comment #16
salvis