return true;
}
+ /**
+ * Update user groups in the external authentication database.
+ * Return true if successful.
+ *
+ * @param $user User object.
+ * @param $addgroups Groups to add.
+ * @param $delgroups Groups to remove.
+ * @return Boolean
+ */
+ public function updateExternalDBGroups( $user, $addgroups, $delgroups = array() ) {
+ return true;
+ }
+
/**
* Check to see if external accounts can be created.
* Return true if external accounts can be created.
* @see $wgAutopromoteOnce
*/
public function addAutopromoteOnceGroups( $event ) {
- global $wgAutopromoteOnceLogInRC;
+ global $wgAutopromoteOnceLogInRC, $wgAuth;
$toPromote = array();
if ( $this->getId() ) {
$toPromote = Autopromote::getAutopromoteOnceGroups( $this, $event );
if ( count( $toPromote ) ) {
$oldGroups = $this->getGroups(); // previous groups
+
foreach ( $toPromote as $group ) {
$this->addGroup( $group );
}
+ // update groups in external authentication database
+ $wgAuth->updateExternalDBGroups( $this, $toPromote );
+
$newGroups = array_merge( $oldGroups, $toPromote ); // all groups
$logEntry = new ManualLogEntry( 'rights', 'autopromote' );
* @return Array: Tuple of added, then removed groups
*/
function doSaveUserGroups( $user, $add, $remove, $reason = '' ) {
+ global $wgAuth;
+
// Validate input set...
$isself = ( $user->getName() == $this->getUser()->getName() );
$groups = $user->getGroups();
// Ensure that caches are cleared
$user->invalidateCache();
+ // update groups in external authentication database
+ $wgAuth->updateExternalDBGroups( $user, $add, $remove );
+
wfDebug( 'oldGroups: ' . print_r( $oldGroups, true ) );
wfDebug( 'newGroups: ' . print_r( $newGroups, true ) );
wfRunHooks( 'UserRights', array( &$user, $add, $remove ) );