PiRSquared17 / improved-accesscontrol

Automatically exported from code.google.com/p/improved-accesscontrol
0 stars 0 forks source link

Support for MediaWiki usergroups #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Only Usergroup: style groups are currently usable for access control. This
extension should work with native MediaWiki groups as well.

Original issue reported on code.google.com by eisenst...@gmail.com on 10 Nov 2008 at 7:44

GoogleCodeExporter commented 9 years ago
Use this function in "accessHookSupport.php"

function efIACUserCanAccessMediaWikiGroups( &$user, &$accessGroups, $action ){

  global $egReadOnlyActionAccess;
  global $wgUser;
  $explodedGroups = explode( ',,', $accessGroups );
  $userGroups = $wgUser->mGroups;
  $userName = trim($user->getName());

  if(in_array($userName, $explodedGroups))
  {
                efIACDebugLog("(efIACUserCanAccessPageGroups)"."full access granted 
");
                return true;
  }
  if(in_array($userName."(ro)", $explodedGroups) && in_array( $action, 
$egReadOnlyActionAccess ))
  {
                efIACDebugLog( "(efIACUserCanAccessPageGroups)"."read-only access 
granted ");
                return true;
  }
        foreach($userGroups as $usergroup)
        {
                if(in_array($usergroup, $explodedGroups))
                {
                        efIACDebugLog("(efIACUserCanAccessPageGroups)"."full access 
granted ");
                        return true;
                }
                else if(in_array($usergroup."(ro)", $explodedGroups) && in_array
( $action, $egReadOnlyActionAccess ))
                {
                        efIACDebugLog( "(efIACUserCanAccessPageGroups)"."read-only 
access granted ");
                        return true;
                }
        }
        return false;
}

Original comment by quochoa....@gmail.com on 29 May 2009 at 1:23

GoogleCodeExporter commented 9 years ago
On my wiki it doesn´t work with user, and also it doesnt´t work with 
Mediawiki groups (although we have put this code in accessHookSupport.php).

Can you help me?

Original comment by Mediawik...@googlemail.com on 14 Dec 2011 at 10:19