Simple Machines Blogs > Developers' Blog

SMF MediaWiki integration released

<< < (9/36) > >>

planet9:
I have only 2 remaining issues.  The most important is limiting the MW edit capability to only the SMF Admin group and a new "Wiki Editor" group; the SpecialGroups settings seem to have no effect.

The other issue is that from MW the logout link has no effect; the user stays logged in.


--- Quote from: SleePy on April 01, 2012, 03:28:55 PM ---As the note below that setting says, it doesn't work well with SSI. 

--- End quote ---

That presumes one knows what SSI is and what it does.  Being new to SMF and MW, I wasn't very aware of it.


--- Quote from: SleePy on April 01, 2012, 03:28:55 PM ---I've updated the Auth file just now.  This one appears to work properly with MediaWiki 1.18

I'v also added your issue to the readmes FAQ section.  Hopefully that helps others in the future :)

--- End quote ---
Excellent. Thanks.

SleePy:
The special groups is what you want to assign people to the Wiki Editor group.  In SMF you create that group,  Get that group ID (ie its in the url when you are editing the group).
If you don't want these editors to be apart of a default MediaWiki group, you will need to create that group in MediaWiki.  FYI you are looking to use $wgRestrictionLevels and $wgGroupPermissions.  You can search for more on creating groups In Media Wiki for how to setup that group.

In the Config you use SMFs group ID and The MediaWiki Group Name.

$wgSMFSpecialGroups = array(
   // SMF Group ID => Wiki group name.
   5 => 'autoconfirmed',
);

From this, group ID 5 is the Jr Member group on SMF by default.  Then you have the autoconfirmed group on MediaWiki.  So users in group 5 on SMF automatically would be put into that group.

Denying access like that you would want to use the $wgSMFGroupID array.  Add those SMF group IDs to that array.  IE in the example code it is using SMF group ID 2, which is global moderators.

FYI, note that this Auth module does cache a lot of stuff to keep it from using too many resources every time to auth the user.  So it may require some time for the auth to update with the new group permissions.

For your logout issue, as long as your are logged into SMF, you can't log out of the wiki.  The auth will auto log you in again.  If there is a way to change the logout link or override it I haven't looked.  I don't see session information being passed to the link.  I wouldn't know if it could be trusted to not cause a CSRF problem.  So I wouldn't even want to think of it if its not going to prevent that.


Edit,

Also forgot to say that you need this line as well to deny all users editing by default:
$wgGroupPermissions['*']['edit'] = false; // MediaWiki Setting

planet9:
Thanks SleePy. 

I'm confused and maybe there are multiple versions of the LocalSettings comments.  Mine say that $wgSMFGroupID   is for granting access and $wgSMFDenyGroupID is for denying.  And $wgSMFAdminGroupID is for admins.

So I'm confused on what $wgSMFGroupID really does.  Thanks.

----
I also have another version which includes the items below and I assume these are deprecated?


--- Code: ---// This tells the Plugin to require a user to be a member of the above SMF group. (ie. wiki) Setting this to false will let any SMF user edit the wiki.
#$wgSMF_UseWikiGroup = true;

// Name of your SMF group users need to be a member of to use the wiki. (i.e. wiki)
#$wgSMF_WikiGroupName  = 'Wiki Editor';

--- End code ---

---
I've had to modify Auth_SMF.php to not check "isLoggedIn()" when using $wgSMFDenyGroupID


--- Code: ---// Lastly check to see if they are not banned and allowed to login
if (!$wgAuth->isNotBanned($ID_MEMBER) || !$wgAuth->canLogin())
{
#if($user->isLoggedIn()) // COMMENTED OUT THIS LINE
$user->logout();
return true;
}

--- End code ---

Otherwise the error I see is:

--- Code: ---Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/public_html/wiki/includes/User.php on line 2295

Warning: array_unique() [function.array-unique]: The argument should be an array in /home/public_html/wiki/includes/User.php on line 2295

Warning: Invalid argument supplied for foreach() in /home/public_html/wiki/includes/User.php on line 3475

Warning: Invalid argument supplied for foreach() in /home/public_html/wiki/includes/User.php on line 3484
MediaWiki internal error.

--- End code ---

Shuban:
Here's mine.

Been working extra hard trying to get the theme to match my own:

http://biology-forums.com/definitions/

Let me know your opinions!

Predat0r:
First off: Thank you a lot for this most awesome extension!

I experienced a really nasty bug using it, that I just had to post here.
I had a fresh install of MW and installed the extension + configured it. I enabled the cookie system and made some group assignments, nothing fancy. The first try went good, I was logged into MW.
But from this point, I always got this error and cookie login didn't work anymore:

--- Code: ---Notice: Array to string conversion in [...]/extensions/Auth_SMF.php on line 162
--- End code ---
Line 162 is:

--- Code: (php) ---$user_settings['smf_groups'] = array_merge(array($user_settings['id_group'], $user_settings['id_post_group']), explode(',', $user_settings['additional_groups']));
--- End code ---

So I made some debug outputs and finally found out that $user_settings contained a string instead of an array, the same string that was serialized into $_SESSION['user_settings']. After some more debug outputs, I found that $user_settings contained a string after this statement in line 140 was executed:

--- Code: (php) ---$_SESSION['user_settings'] = serialize($user_settings);
--- End code ---
After blaming serialize and trying other crazy stuff, I found out that renaming $user_settings to $usr_settings fixed the error and logging in worked perfectly! WTF?
I am not familiar with PHP, so I don't know if this is possible, but could this error originate in the name equality of $user_settings and $_SESSION['user_settings']? Maybe someone of you can tell me why this happened.


Regards

PS: I am using PHP 5.2.17, MySQL 5.5.19 and an Apache 2.2.22 on CentOS release 6.2 (Final).

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version