Topic: Corrupt Permissions - Table Cross Associations Missing!!

Hi Folks,
  I am out of my league with this one... got a call today because people are having access to things they shouldn't in one of the BB's...

  I finally discovered that in the forum_perms table there are expected rows missing for many groups...
   ...where a group_id #X  only has associations from forum_id 3 thru 126 instead of up to #138 !!!  I do not know what other tables may also have similar or related corruption.

   When I created a new Group in PunBB it seemed to re-include the full range (fixing the problem for that group), so for instance,
     - I have a group named Validating. 
     - Validating was screwed up in the forum_perms table (per the above). 
     - So in the BB I Created a new Group named TestGroup with all the same settings as the Validating Group,
     - then I deleted the Validating Group, moving all the Validating Members to TestGroup
     - After renaming TestGroup to Validating I checked...
     - Checking Forums and such via Administration the Permissions were correct(ed)
     - Checking the forum_perms Table in mySQL reveals associations for that group_id with All forum_id's are accounted for.

So now I am faced with ...is there a way in mySQL to have the Table Repair/Correct itself??  Of course, I ran repairs and such, but that did not 'do it'.

One thing I am really concerned about, say the only way to fix this is to conduct the method above for every Group in the BB....  well what do I do about the built in Groups such as Admin, Guest, Moderator, etc ??? Those are corrupted as well !!!!

What a freaking mess this is... I am just sick over it... how in the heckl could this have happened???

Your help, as always, is much apreciated.
TwoHawks

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

Nothing is sounding "corrupted" to me. forum_perms only has permissions for a group when the permissions deviate from the defaults for the group. So, if the default permission for a group is to be able to read a forum, forum_perms will only have an entry when the group has specifically been denied access to the forum.

And I just double checked the code for admin_groups.php: basing a group on another group copies the exact same forum_perms entries, it doesn't add any new ones.

3 (edited by twohawks 2007-07-13 23:26)

Re: Corrupt Permissions - Table Cross Associations Missing!!

Thanks for looking at this, Smartys.

Hmmm...  Well I wonder why when I 'rebuilt' (so-to-speak) the Validating Group that the new Validating Group then was included with the rest of the forum_id associations when it was not before?

In the BB it looked like this... 
   1) when going into Administration:Forums, selecting an older forum, and then observing the Groups listed, Validating Group should have the 'read attribute' appearing as Red with no checkmark, and it did,
   2) but what it was appearing as for recent forums was greyed out, with a checkmark in the greyed out box (when it should be same as in #1, to be sure).
   3) If I created a group with same attributes as Validating it would demonstrate the Red Highlighting with no checkmark, as it should, in old or new Forums lised in Administration.
   4) But if I edited the existing Validating Group, saved it, and then edited it back to original settings it would still appear greyed out, with a checkmark in there.  (I expected it might 'correct' itself if I edited it, but it did not).
   5) Deleting it and recreating it, as described in my original post, corrected it...

...but so many others are messed up as well, including Guest, Member, Moderator, and, well, I am uncertain yet about Administrator.  And how would I fix those if need be?
So I am trying to figure out just what this problem is and how to globally fix it?
Do you see the problem?  If its, as you say, not table corruption, then what is that exactly??

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

I'm looking at a default admin_forums.php
Checkboxes are only disabled for redirect forums (in which case all except for the ability to read box are disabled) and when the group has the ability to read on a global scale disabled (which only disables the ability to check the can/can't read box).
And as I said, no new permissions are made up when you create a new group based on an old group.

So, I assume you've modified these files? wink

5 (edited by twohawks 2007-07-14 00:04)

Re: Corrupt Permissions - Table Cross Associations Missing!!

I will go look now. 
So you think that although redoing a fresh group allows the appearance to display correctly,
and even though this also creates different entries in the database (which seem to correct the problem),
that the admin_forums.php file might be the problem and not the database?

I will go check that out and edit this post in a couple minutes with repsonse to your question.


OKAY, I checked and the only mod to it is to add the "parent_forum_id" from I believe it is the sub-forum mod, which was added forever ago (Sep 22, 2006 to be precise), so I think I would have observed problems long before now if it was the culprit.

Validating Group was originally made long time ago last year based on guest (who have read permissions set to on), and then all permissions including read were turned off.  So guests can view certain public forums, but 'validating' users get nothing... they have to wait for the admin to custom setup their profiles.  Iknow, it sounds weird, but its the way she wants to handle it.

Anyway, I am going to look at the admin_groups.php file and see what's up there  as well.

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

Nope, admin_groups.ph only has the view_users edit in it, applied two days after I deployed PunBB1.2.12 back in Sept last year. 

So I really do not htink its anything to do with changes to these files at all.

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

Then your story doesn't add up, since what you're describing doesn't seem possible given the code.
I would need admin access, the ability to execute SQL queries, and information about a specific group currently having this issue in order to determine anything more.

Re: Corrupt Permissions - Table Cross Associations Missing!!

Thank you very much, Smartys.
I will email you an admin login and password.
Please give me a little time to set that up, and I wish to include some snapshots inthat email for clarity... I am thinking I am failing to accurately describe the problem.

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

I clicked on your email link and sent you something.  Did you get it?  Is this something you wish to do and have time for?

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

No, I didn't get it: try sending to smartys@ this domain

11 (edited by twohawks 2007-07-14 01:14)

Re: Corrupt Permissions - Table Cross Associations Missing!!

I just sent you an email ...including some snapshots and some descriptions.
Oh and btw, Willow (the admin for the forum) just came up and showed me how Validating is still messed up for some other forums 8^(

You may wish to include looking at the forums under the category "SPIRITUAL RELATIONSHIP" where she just had to turn off Post Replies for Validataing, and also you will see the greyed out check box with the checkmark in it in those forums.

What a disaster this is.

Thanks so much for looking & helping.

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

I'll say what I said to you in the email. smile
It looks to me like there isn't actually an issue. The disabled checkboxes are disabled because that group has had its ability to read the forum removed, which supersedes any per-forum settings. So checked or not, they can't read the forums.

Re: Corrupt Permissions - Table Cross Associations Missing!!

Hmmm... but we used to give Guests read permissions, but right now if you turn that on you will observe they see Forums Christina, Two Hawks, and a small group, in the list (when not logged in, right)... and you cannot turn that off... but we always were able to before.

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

twohawks wrote:

Hmmm... but we used to give Guests read permissions, but right now if you turn that on you will observe they see Forums Christina, Two Hawks, and a small group, in the list (when not logged in, right)... and you cannot turn that off... but we always were able to before.

Once you turn the guest read forum permissions back on, the checkboxes will no longer be disabled and you can uncheck them.
My suggestion? Turn on maintenance mode, re-enable reading for guests, and then go through all the forums and remove read permissions for guests

Re: Corrupt Permissions - Table Cross Associations Missing!!

Whoa, wait a minute... I think that was something Willow did, I can turn that off...

TwoHawks
Love is the Function
No Form is the Tool

16 (edited by twohawks 2007-07-14 01:36)

Re: Corrupt Permissions - Table Cross Associations Missing!!

Question, If I turned off read and post permissions for Validating (after recreating) then why would we have to go in and turn off the Post checkmark that appeared afterward in several forums?  Should it not become disabled when I turned those attributes off?

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

Because somebody checked the box to enable them

18 (edited by twohawks 2007-07-14 01:42)

Re: Corrupt Permissions - Table Cross Associations Missing!!

Hmmm... alrighty then, Smartys.. so you seem to be convinced things are functioning as they should be.  This is very encouraging.  I guess I have to consider manually grooming the whole place and then running some tedious tests, and then very closely monitoring how Willow creates new groups and changes things (?).
   Thank you so very much for taking the time.  I will post back here at some later date to provide updated feedback for anyone who may benefit, or if I feel there is still something "smelly in Denmark" ;^)

I have to say, though, this still does not explain why recreating the Validating Group auto-created more table entires in the database than were originally there (associations with newer forum_ids were generated). ?

Cheers,

TwoHawks
Love is the Function
No Form is the Tool

Re: Corrupt Permissions - Table Cross Associations Missing!!

Nope, it doesn't make sense, assuming that's the only thing you did

        // Now lets copy the forum specific permissions from the group which this group is based on
        $result = $db->query('SELECT forum_id, read_forum, post_replies, post_topics FROM '.$db->prefix.'forum_perms WHERE group_id='.intval($_POST['base_group'])) or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error());
        while ($cur_forum_perm = $db->fetch_assoc($result))
            $db->query('INSERT INTO '.$db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$new_group_id.', '.$cur_forum_perm['forum_id'].', '.$cur_forum_perm['read_forum'].', '.$cur_forum_perm['post_replies'].', '.$cur_forum_perm['post_topics'].')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $db->error());

Of course, if you went and edited forums afterwards, it might have added entries for the forums you edited

Re: Corrupt Permissions - Table Cross Associations Missing!!

No I did not do that.  I immediately checked the tables after recreating that group and the difference I mention was immediately apparent.  Willow (only other admin) could not have interfered either because at the time she was not at a computer.

I think the only thing left to do is... I have to do my homework, as mentioned above, and then very carefully record what takes place.

I hope to take time out over the weekend periodically.  I will wait until I assemble substantive and uniform information, and in the form of a demonstrable excersize for exposing an issue, if there is one that is not "user-error" related  ;^)

Thanks again, Smartys... I am very grateful for your assistance today.
Be well,
Two Hawlks

TwoHawks
Love is the Function
No Form is the Tool