News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Create board permission bug in SMF 1.1 RC2

Started by auto394812, January 05, 2006, 04:21:10 AM

Previous topic - Next topic

auto394812

I am using SMF 1.1RC2 and I believe there's a bug in permissions when trying to create a new board that's really annoying.
I created 15 new boards and set their permissions to read only. I found out later that the admin script didn't set the permissions correctly because either this forum runs on a logic that I don't understand  or you have conflicting statements regarding $modSettings['permission_enable_by_board']. Yes, I already fixed it by going into phpmyadmin and doing an update statement, and I don't need help with that. What I do need help with is understanding this forum's logic.

In manageboards.templates.php you have this line which shows that administrators can set permissions when creating a board:
if (empty($modSettings['permission_enable_by_board']))
{
echo '
<tr>
<td valign="top">
<b>', $txt['mboards_permissions_title'], '</b><br />
', $txt['mboards_permissions_desc'], '<br />
</td>
<td align="right">
', $txt['permission_mode_normal'], ' <input type="radio" name="permission_mode" value="0" class="check"', $context['board']['permission_mode'] == 'normal' ? ' checked="checked"' : '', ' /><br />
', $txt['permission_mode_no_polls'], ' <input type="radio" name="permission_mode" value="2" class="check"', $context['board']['permission_mode'] == 'no_polls' ? ' checked="checked"' : '', ' /><br />
', $txt['permission_mode_reply_only'], ' <input type="radio" name="permission_mode" value="3" class="check"', $context['board']['permission_mode'] == 'reply_only' ? ' checked="checked"' : '', ' /><br />
', $txt['permission_mode_read_only'], ' <input type="radio" name="permission_mode" value="4" class="check"', $context['board']['permission_mode'] == 'read_only' ? ' checked="checked"' : '', ' /><br />
<br />
</td>
</tr>';
}

So basically, if the $modSettings['permission_enable_by_board'] is not set or EMTPY then it shows the permissions. I did a quick test and my $modSettings['permission_enable_by_board'] was indeed MT. OK, with that logic let's see what happens later on...
We are now looking at Subs-Boards.php within the createBoard function when the code goes though here:

if ($boardOptions['inherit_permissions'] && empty($modSettings['permission_enable_by_board']))
{
$request = db_query("
SELECT permission_mode
FROM {$db_prefix}boards
WHERE ID_BOARD = " . (int) $boards[$board_id]['parent'] . "
LIMIT 1", __FILE__, __LINE__);
list ($boardOptions['permission_mode']) = mysql_fetch_row($request);
mysql_free_result($request);
}

Alright... another quick check shows my $boardOptions['inherit_permissions'] set to 1. So this IF statement evaluates to TRUE which means any settings I just made in my Create board screen was all for naught because the stupid thing gets set to the permission setting of the parent board.

So to summarize, I only see those options if $modSettings['permission_enable_by_board'] is empty and if it is empty, then anything you choose won't do a damn bit of difference because it gets overridden later by the parent's permissions.

I now ask the question, Why do I even see those options if they don't do anything?

What's especially troubling is that not only does this bug show up, which made me think that board-level options were always going to default to the parent's permissions, I go to edit a board and find those same options available and this time when I edit the board's permissions, it works fine. WHERE'S THE CONSISTENCY THERE?! AAAAGGH!  1+2=1?! Cats == Dogs!

So what's the bug here? Should I set the templates to not even show those options if $modSettings['permission_enable_by_board'] is MT or should I change the logic within the createBoard function?

auto394812

So, is this a well-known bug?

Can anyone help confirm this or (even better) help fix this?

Advertisement: