Closed (fixed)
Project:
Private
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
1 Mar 2011 at 18:02 UTC
Updated:
6 Sep 2012 at 19:41 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Joe90 commentedHi
I have not installed this module yet as I am only running Drupal 7, but I did try to run your patch. I got a long list of HUNK errors on a dry run:
Any suggestions ( I did check the file permissions were writeable)
Thanks
Joe90
Comment #2
Joe90 commentedAh, I just took -p0 out of my command and the patch works. Off to try it out!
Thanks
Comment #3
Joe90 commentedOK, installed, a couple of issues.
1. The patch doesn't clear out the v6 info from private.info, so you have to delete it manually, then it is happy to install properly.
2. Get this error:
Notice: Undefined property: stdClass::$private in private_node_view() (line 274 of ../modules/private/private.module).which relates to this:
Line 274 being "if($node->private){"
So unticking for now
Comment #4
Anonymous (not verified) commentedAttached is a port that fixes the translations for privledges. I've tested this in a site with no access control, and with a site that had OG running, everything worked fine.
Comment #5
Anonymous (not verified) commentedOops, missed the permission descriptions.
Comment #6
Joe90 commented@ kevee
Thanks for the update but this has not resolved either of the issues in #3 above.
I have ACL / Forum Access / Menu per Role / Chain Menu Access up and running. Simple Access is disabled at present due to issues with that one!
Comment #7
Anonymous (not verified) commentedAnother note: this module needs to wait for #1013864, as that makes any node in a book die when using access control.
Comment #8
artatac commentedsub
Comment #9
Anonymous (not verified) commentedAttached is new patch that solves crashing issue in databases that don't give back number of updated rows.
Comment #10
eileen commentedSubscribe
Comment #11
idflood commentedI've tested the patch in #9 and it working nicely on my setup. I had a notice when editing a node so I changed the line 156 in private.module from this:
$privacy = $node->private;
to this:
$privacy = isset($node->private) ? $node->private : 0;
The test setup had ~1000 nodes. I made some nodes private and then did the test in two steps.
1. see if the node is listed in a view without changing the view
2. try to access a node from his path ( node/xy ).
I did this with an anonymous user and another authenticated user. Everything is behaving as expected. The nodes are simply not shown in the view if they are private. Then if the nodes are directly accessed the "You are not authorized to access this page." is shown.
I've also ran the module through coder and fixed some spacing issues.
Comment #12
idflood commentedI've added some tests and they all pass as they should. Also some changes like the one described in #11, only in more places.
Comment #13
Anonymous (not verified) commentedThanks, idflood, works for me. Changing to reviewed & tested.
Comment #14
damienmckennaAdjusting the title to not get lost in Dashboard.
Comment #15
hefox commented1)
The private_node_update can causes query errors cause $node->private is not necesirly always set (which may be a seperate bug); private_node_load looks all results in the database, but if there's no results ... well, no results.
Then it actually fails again with duplicate ID; instead of that awkward update, check if updated, insert code can do
(thanks to dekita on #drupal channel for telling me about db_merge).
That table doesn't exist. It's files_managed now and it doesn't have an nid column (does files have it in 6? might be a pre-existing issue. I think upload keeps track of it's own download).
Why not:
To tired to make patchy.
Comment #16
pjcdawkins commentedSubscribe
Comment #17
mattias commentedSubscribe
Comment #18
JoshOrndorff commented@hefox, regarding your last question:
I see that those two are functionally the same and the latter is shorter, but the former is more readable IMHO. I had written several sentences about the differences and then I remembered that empty() considers a boolean FALSE to be an empty value.
Just my two cents.
Comment #19
hefox commentedI find !empty much more readable personally; I've never seen a ternary operator used in a if statement before so it was a big WTF moment.
Typo in the update function
Comment #20
JoshOrndorff commentedyeah, actually, I totally agree with you. I was reading that line wrong before. I think !empty() is the way to go too.
Comment #21
hefox commentedHere's current patch using.
Fixes stuff above + theme('image' the alt/title got movd to width, height tags o.O
Comment #22
hefox commentedToo lazy to update patch atm, but for views ingergration 'Node' => 'content' for label
Comment #23
Squant commentedHelp! I installed the dev version of the module, patched it, followed the instructions to rebuild permissions, and everything worked fine. Until I logged out - access denied for guests everywhere. I uninstalled the private module, rebuild permissions again, but guests are still blocked. I think it messed up my database when updating permissions.
What happened? How to restore to normal?
Update: Disabling the ACL module fixed the issue.
Comment #24
bcn commentedPatch from #21 applies cleanly for me to a 6.x-dev version with:
patch -p0 < private_1077600_d7_port_21.patchNot sure exactly what is meant in #22 about what's missing in the views integration?
Comment #25
hefox commentedThe fields appear under 'Node', whereas all other node related stuff appears under 'Content', so it's allll lonely.
Comment #26
bcn commentedYeah, I saw what you mean..
I think in
private_views_data(), this:Should be:
Comment #27
hefox commentedNew one
the view filter also had to be updated from add_where to add_where_expression
Comment #28
highmastdon commentedSubscribe
Is there a 'final' beta version just for Drupal 7. 7.x-dev maybe?
Comment #29
eme commentedSeems not. There is still a lot of work to do here :
For what i saw, we need to change the first condition in private_form_alter (first line of the function), for example :
if (strpos($form_id, '_node_form')) {works fine.Seems that hook_node_grants has changed as well : http://api.drupal.org/api/drupal/modules--node--node.api.php/function/ho...
Comment #30
JohnnyX commentedI'm searching for an taxonomy term based access control which is controled by the user/ author.
It should work similar to access by term module, but controled by
the users not administrators
For example...
Each user can tag other users with a taxonomy term (private/ own taxonomy term, not viewed to other users). This terms act as groups/ friend lists. so not only private/ public access, but rather a friend list(s) based access.
Author tag his nodes with his terms (groups/ friend lists) to grant access.
Any chance to get such a feature build in?
Comment #31
frjo commentedI have updated the D7 patch and tested the basic functionality.
I have made fixes with the help of the node_access_example module and have run it through Coder.
Please test and report back here.
When this patch works well I plan to ask to be made a co-maintainer of the module and release a D7 version.
Comment #32
q0rban commentedLots of great work in here! Some things to consider:
This looks to be a bug in the d6 version as well, but shouldn't the above be
$node->privatenot$node->privacy?Can we break this out? It's very hard to read ternaries inside of other code. I would break all the t() placeholders out into a separate array variable to then pass to t().
This whole section is confusing the heck out of me. First of all, there is no nid column in the files table in d6. Second of all, there is no files table in d7. Perhaps this is supposed to be joining to the file_usage table? I'd almost propose just removing this code altogether, because I can almost guarantee it doesn't work in d6.
Shouldn't this be
$node->content['links']['private']?For readability, let's break this out into a $variables array().
Again, ternaries inside code like this are hard to read. :)
Comment #33
eaton commentedThis patch and a couple of other very minor fixes have been committed to the new 7.x-1.x branch. I'll be rolling a 7.x-1.1 release shortly. Thanks, everyone!