Merge "add and use updateExternalDBGroups function, fixes #49641"
[lhc/web/wiklou.git] / includes / User.php
index f205371..46450e6 100644 (file)
@@ -1162,16 +1162,20 @@ class User {
         * @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' );