Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Aiheen aloitti: Bonk - marraskuu 28, 2005, 09:55:11 AP

Otsikko: Board Access Permissions Report - Single Page
Kirjoitti: Bonk - marraskuu 28, 2005, 09:55:11 AP
I am in the process of compiling access permissions for all boards to report to admins and moderators. It is very painful to do manually.

Once I got so far into it I decided I am going to write a script to do it.  (duh!)

Perchance has anyone else already done so?
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: Grudge - marraskuu 28, 2005, 10:42:13 AP
Ummm... this is what I wrote the "Generate Reoprts" function for in 1.1, no?
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: Bonk - marraskuu 28, 2005, 11:01:10 AP
Oh goody! Good plan stan! (Great minds think alike!  ;))

I'm still on 1.0.5 and looking forward to a final 1.1.

I'll write my own script to do the job in the meantime...
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: Grudge - marraskuu 28, 2005, 12:54:54 IP
It's in SMF 1.1 RC1 if you want to download a copy to see what it does. It's cool I think - but I'm biased :D
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: Bonk - marraskuu 28, 2005, 01:38:24 IP
Sounds great, but I am assuming that code won't help me much on a 1.0.5 database. I'll wait till 1.1 is final. (no pressure)

What I need to know is what the non-existent membergroup IDs 0 and -1 signify in 1.0.5... I imagine one of them is 'guest'?
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: gri - marraskuu 28, 2005, 03:09:06 IP
Lainaus käyttäjältä: Bonk - marraskuu 28, 2005, 09:55:11 AP
I am in the process of compiling access permissions for all boards to report to admins and moderators. It is very painful to do manually.
Perchance has anyone else already done so?

Grudge,
is it possible to add an option
to show Users the permission pages
                                   in read only mode ?

This also concerns all admin pages
in the same original structure.
It may be just a permission - "to READ permissions"
                                              for Users/Guests.

An option would be named "Publicity".

The Publicity swithed ON will allow Guest to make a decision
              without wasting time on registering.

As well as in case of a switched OFF ~Publicity~ forum.
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: Bonk - marraskuu 28, 2005, 03:56:42 IP
In case anyone was wondering about the membergoups -1 and 0:

-1 = Guests
0 = Ungrouped Members

Thanks MrCue!
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: Grudge - marraskuu 28, 2005, 04:02:52 IP
gri,

Although I see that some people may find that useful I personally don't think many users/guests would be interested in what the priviledges are, but it could be easily hacked in by removing the call is isAllowedTo('admin_forum') and admin_index in Reports.php.

Grudge
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: gri - marraskuu 28, 2005, 09:03:11 IP
Lainaus käyttäjältä: Grudge - marraskuu 28, 2005, 04:02:52 IP
gri,

Although I see that some people may find that useful
I personally don't think many users/guests would be interested
in what the priviledges are,
  but it could be easily hacked in by removing the call
   is isAllowedTo('admin_forum') and admin_index in Reports.php.

Grudge

Can you write a mod ?

The beginning of the Mod ~Glasnost'~ .
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: Bonk - marraskuu 29, 2005, 09:23:38 AP
Here is the script I wrote yesterday to do it for an SMF 1.0.5 db. (it is meant to fit into our site templates and permissions structure so place it accordingly, also the colors are to match our site scheme) It is not integrated with SMF at all, it is an indpendent script. (except for reading the smf db) You may need to edit the queries to use your SMF table prefix if different. I find it faster to write things myself than to spend all the time necessary to figure out the logic of someone else's codebase. Please don't laugh, it works for me!  ;D


<?php 

echo ("<center><h2><font color=\"#FF0000\">Board Access Permissions Report</font></h2></center>");

$SMFdbhostname      "***YOUR_DB_HOSTNAME***";
$SMFdbport "***YOUR_DB_PORT***";
$SMFdb "***YOUR_DB_NAME***";
$SMFdbuser      "***YOUR_DB_USER***";
$SMFdbpass  "***YOUR_DB_PASSWORD***";

$link mysql_connect($SMFdbhostname .":" .$SMFdbport$SMFdbuser$SMFdbpass);
   
mysql_select_db($SMFdb);

    
$query "SELECT ID_BOARD, ID_CAT, childLevel, boardOrder, memberGroups, name FROM smf_boards ORDER BY ID_CAT, boardOrder";
    
$result mysql_query($query);
$a=0;
while ($line mysql_fetch_array($resultMYSQL_ASSOC)) {

$BRD_ID_BOARD[$a] = $line['ID_BOARD'];
$BRD_ID_CAT[$a] = $line['ID_CAT'];
$BRD_childLevel[$a] = $line['childLevel'];
$BRD_boardOrder[$a] = $line['boardOrder'];
$BRD_memberGroups[$a] = $line['memberGroups'];
$BRD_name[$a] = $line['name'];

$a=$a+1;
    
}
    
mysql_free_result($result);


    
$query "SELECT ID_GROUP, groupName, onlineColor FROM smf_membergroups";
    
$result mysql_query($query);
$b=0;
while ($line mysql_fetch_array($resultMYSQL_ASSOC)) {

$MGRP_ID_GROUP[$b] = $line['ID_GROUP'];
$MGRP_groupName[$b] = $line['groupName'];
$MGRP_onlineColor[$b] = $line['onlineColor'];

$b=$b+1;
    
}
    
mysql_free_result($result);


    
$query "SELECT ID_CAT, catOrder, name FROM smf_categories ORDER BY catOrder";
    
$result mysql_query($query);
$c=0;
while ($line mysql_fetch_array($resultMYSQL_ASSOC)) {

$CAT_ID_CAT[$c] = $line['ID_CAT'];
$CAT_catOrder[$c] = $line['catOrder'];
$CAT_name[$c] = $line['name'];

$c=$c+1;
    
}
    
mysql_free_result($result);

    
mysql_close($link);

$MGRP_Index = array();
$MGRP_Color = array();

$MGRP_Index[-1] = "<b>GUESTS</b>";
$MGRP_Index[0] = "Ungrouped Members";
$MGRP_Index[''] = "";
$MGRP_Color[-1] = "";
$MGRP_Color[0] = "";
$MGRP_Color[''] = "";
for ($l=0$l <= $b-1$l++) {
$MGRP_Index[$MGRP_ID_GROUP[$l]] = $MGRP_groupName[$l];
$MGRP_Color[$MGRP_ID_GROUP[$l]] = $MGRP_onlineColor[$l];
}


for ($i=0$i <= $c-1$i++) {
echo ("<h3><font color=\"#FFCC33\"><u>");
echo $CAT_name[$i];
echo ("</u></font></h3>");
for ($j=0$j <= $a-1$j++) {
if ($BRD_ID_CAT[$j] == $CAT_ID_CAT[$i]){
if ($BRD_childLevel[$j] > 0){
echo ("&nbsp;&nbsp;&nbsp;");
}
echo ("<b><font color=\"#FFCC33\">");
echo $BRD_name[$j];
echo ("</font></b>");
echo (": ");
//echo $BRD_memberGroups[$j];
$memberGroupsThisBoard explode(","$BRD_memberGroups[$j]);
for ($k=0$k <= count($memberGroupsThisBoard)-1$k++) {
if ($MGRP_Color[$memberGroupsThisBoard[$k]] <> "" and $MGRP_Color[$memberGroupsThisBoard[$k]] <> " "){
echo ("<font color=\"");
echo $MGRP_Color[$memberGroupsThisBoard[$k]];
echo ("\">");
}
echo $MGRP_Index[$memberGroupsThisBoard[$k]];
if ($k count($memberGroupsThisBoard)-1) {
echo (", ");
}
if ($MGRP_Color[$memberGroupsThisBoard[$k]] <> "" and $MGRP_Color[$memberGroupsThisBoard[$k]] <> " "){
echo ("</font>");
}
}
echo ("<br>");
}
}
}

?>

Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: gri - joulukuu 25, 2005, 06:11:30 AP
Lainaus käyttäjältä: Bonk - marraskuu 29, 2005, 09:23:38 AP
I find it faster to write things myself than to spend all the time
necessary to figure out the logic of someone else's codebase.

Have not found "admin_index" in Report.php .

Anybody ?
Otsikko: Re: Board Access Permissions Report - Single Page
Kirjoitti: Thantos - joulukuu 25, 2005, 07:10:07 AP
I think grudge meant adminIndex()