Advertisement:

Author Topic: Groups don't work properly on new users (with suggested fix)  (Read 6921 times)

Offline jelv

  • Semi-Newbie
  • *
  • Posts: 50
  • Gender: Male
Groups don't work properly on new users (with suggested fix)
« on: October 24, 2009, 07:41:04 PM »
SMF 1.1.10
Mambo 4.6.5
Bridge 1.1.2

Symptoms: I'm using SMF registration - the forums have been converted from phpBB so I have loads of users in SMF which do not exist in Mambo. I have mapped the groups in the SMF bridge - including some groups which map to author. When you log in a user is created in Mambo. What I was finding was that the user was not created with the correct rights - a menu item with access level Special was not displayed to a user in Mambo group Author, even though when displaying the list of users in Mambo his group appeared correct.

Cause: I found that in the Mambo users table when a SMF user was added to Mambo the column usertype was not populated - populating this field and the permissions worked correctly - users belonging to group Author could now see the items with access level special.

Proposed solution: I'm a novice php programmer but this code change seems to have done the trick.

Module components\com_smf\smf.php

660:         //Just in case....
661:         if (!isset($group) || $group == '' || $group == 0 )
662:            $group = '18';
663:      
664:         $mos_sync_groups = mysql_query("
665:               SELECT `name`
666:               FROM " . $configuration->get('mosConfig_dbprefix') . "core_acl_aro_groups
667:               WHERE `group_id` = " . $group
668:               );
669:         list ($group_name) = mysql_fetch_row($mos_sync_groups);
670:   
664:         $mos_write = mysql_query("
665:            INSERT INTO " . $configuration->get('mosConfig_dbprefix') . "users
666:               (name,username,email,password,gid,usertype)
667:            VALUES ('$username', '$username', '$user_settings[emailAddress]', '$passwd', '$group', '$group_name')");
668:   


Edit: Looking at the code in the 2.0 bridge the same problem exists in that version
« Last Edit: October 25, 2009, 06:33:31 AM by jelv »
jelv

Offline jelv

  • Semi-Newbie
  • *
  • Posts: 50
  • Gender: Male
Re: Groups don't work properly on new users (with suggested fix)
« Reply #1 on: November 01, 2009, 07:45:44 PM »
I've found further problems with this module and have now reported this as a bug.

See http://www.simplemachines.org/community/index.php?topic=345334.msg2336828#msg2336828
jelv

Orstio

  • Guest
Re: Groups don't work properly on new users (with suggested fix)
« Reply #2 on: November 01, 2009, 08:04:03 PM »
Interesting, and good work.

I think this is rooted in a bug in Mambo 4.6.5, actually.  The usertype field in the mos_users table is a left-over from Mambo 4.5.0.  By 4.6.x, the ACL tables should be used for all permissions, not the users table.

Offline jelv

  • Semi-Newbie
  • *
  • Posts: 50
  • Gender: Male
Re: Groups don't work properly on new users (with suggested fix)
« Reply #3 on: November 01, 2009, 08:11:07 PM »
Interesting, and good work.

Thanks.

It was a ****** to track down! I found it after editing the user in Mambo and saving it without making any changes - that made it work. So I then had to identify what the difference was in the database.
jelv