Closed (fixed)
Project:
Organic Groups
Version:
5.x-2.2
Component:
og.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Mar 2007 at 23:40 UTC
Updated:
1 Jun 2007 at 08:14 UTC
Coming from a 4.7 with og access control enabled, I experienced some trouble with the 5.x-2.2 version of og.
All the private posts were actually public, even though when editing them, the public box was not checked. I checked the records of these nodes, and they were fine. I tried rebuilding the permissions without any success. I finally found a stange record in the node_access table:
nid=0, gid=0, realm=all, 1, 0, 0
I narrowed down the origin of this record, and found out it had been added by the og module when I disable the access control on my 4.7 website.
I deleted it and everything went back to normal.
Does anybody know what is this record for?
Comments
Comment #1
moshe weitzman commentedthat record grants view access to all users for all nodes. it is natural that it would be written when disabling access control.
Comment #2
scor commentedThis records keeps reappearing after I enable the og access control on the upgrade 5.1 with og 5.x-2.2.
I checked on a fresh install of drupal 5.1 and og 5.x-2.2 and this record doesn't exist.
Comment #3
scor commentedThanks for info. That means that when I activate the og access control on the upgraded 5.1, it should delete this record nid=0 in order to allow the access control on a per node basis. But this record remains in the table whether the access control is enabled or not. (drupal 5.1 and og 5.x-2.2).
Comment #4
scor commentedThanks for info. That means that when I activate the og access control on the upgraded 5.1, it should delete this record nid=0 in order to allow the access control on a per node basis. But this record remains in the table whether the access control is enabled or not. (drupal 5.1 and og 5.x-2.2).
On a fresh install of drupal5.1/og2.2, this record nid=0 doesn't appear at all, whether the access control is activated or not.
Comment #5
scor commentedActually it's working fine on a fresh drupal5.1 with og2.2, but on an upgrade from 4.7 to 5.1 with the latest og2.2, there is always a record nid=0 realm=all in the node_access table, even if the access control is active. I also tried with all the modules disabled, and got the same problem. I have to delete the record manually to have the og access control working.
Comment #6
scor commentedI found out what was wrong. I had 3 node with a uid that was deleted a while ago. Strange, since deleting a user should also attribute its content to the anonymous account, at least that's what happens in drupal5. At the time when I deleted this user I was using drupal 4.6.
When enabling the access control, the og empties the node_access table and check the permissions of every nodes to insert the right rules in node_access. I checked the sql queries log and the following queries were executed 3 times during the og access control activation (in my case where 3 nodes are attributed to a deleted user):
(29 being here the id of one of the 3 corrupted nodes).
I think there is an issue here, preventing og (and any access control system) to work. Assigning a nid=0 in the node_access table grant public access to all nodes!
I changed manually in the db the uid of these 3 nodes to 1, and used the admin account to delete them. (before, even the admin had an access denied when trying to access them). Then the access control worked fine and didn't add any nid=0 in the node_access table.
The node_access summary of the devel module comes useful to check that out, and can find these corrupted nodes for you (Legacy Nodes).
Comment #7
gracearoha commentedI believe i have this same (or a similiar problem) . I also had the same "strange record"
nid=0, gid=0, realm=all, 1, 0, 0.
I have upgraded several times from 4.7 to 1.6.
But i am quite a noob and am having difficult trying to figure out how to detect if i have corrupted nodes. What should i look for in the node access summary that would give me clues?
Is there a mysql query that would help me to find these nodes?
thanks for any insights.
Comment #8
moshe weitzman commentedyou could disable and then enable access control on the admin/og/og to get rid of that record.
Comment #9
scor commentedThis may not fix the problem. This didn't work for me at the time.
gracearoha, if this solution doesn't work, you have to make sure that you don't have any orphan node (ie nodes with a uid that has been deleted). Normally it should be set to 0 automatically, but it wasn't in my case.
Comment #10
scor commentedYou may find this query useful:
it shows all the nodes without author. On a healthy system, it should not return any row, but in my case, it returned all the corrupted rows that I had then to fix manually in phpMyAdmin by changing their uid by a known user (1 for instance).
I also found the legacy node feature of the devel module useful, see an feature request I posted.
Let us know if that helps you to fix your problem.
Comment #11
gracearoha commentedskor,
thanks for the tips. i also could not get rid of the nid=0 by disabling and then re-enabling the access control from the admin/og/og.
so i manually deleted it from the database
and then ran the sql query that you suggested and found quite a number of "owner-less" nodes which i just deleted since the nodes were no longer relevant.
i believe that all is well now...
Comment #12
gracearoha commentedWell, i thought all was well, but the nid=0 recreated itself again.
what to do?
Comment #13
scor commentedI'm glad you found these corrupted nodes.
How did you delete these nodes? you should let drupal do it, by first changing the uid to a existing user (ex 1) and then delete them WITH drupal. if you do it directly in the db, you will have problems.
what I suggest now is to try out the devel module, and go the page with the legacy node feature (devel/node_access/summary). It should tell you more about the whole access control system.