public static function createOrRefreshUser($username,$individualGroupAssignmentOptions = null) {
        if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
            Yii::beginProfile('createOrRefreshUser', static::YII2_PROFILE_NAME . 'createOrRefreshUser');
        }
        
        $userObjectDb = static::findOne(['username' => $username]); 

        //Create user if not found in db
        if ($userObjectDb == null) {        
            $userObjectDb = static::createNewUser($username, $individualGroupAssignmentOptions);
        } else {
            $userObjectDb->setIndividualGroupAssignmentOptions($individualGroupAssignmentOptions);
            $userObjectDb->updateAccountStatus();
            $userObjectDb->updateGroupAssignment();
        }
        
        if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
            Yii::endProfile('createOrRefreshUser', static::YII2_PROFILE_NAME . 'createOrRefreshUser');
        }        
        return $userObjectDb;
    }
public static function createOrRefreshUser($username,$individualGroupAssignmentOptions = null) {
        if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
            Yii::beginProfile('createOrRefreshUser', static::YII2_PROFILE_NAME . 'createOrRefreshUser');
        }
        
        $userObjectDb = static::findOne(['username' => $username]); 

        //Create user if not found in db
        if ($userObjectDb == null) {        
            $userObjectDb = static::createNewUser($username, $individualGroupAssignmentOptions);
        } else {
            $userObjectDb->setIndividualGroupAssignmentOptions($individualGroupAssignmentOptions);
            $userObjectDb->updateAccountStatus();
            $userObjectDb->updateGroupAssignment();
        }
        
        if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
            Yii::endProfile('createOrRefreshUser', static::YII2_PROFILE_NAME . 'createOrRefreshUser');
        }        
        return $userObjectDb;
    }
public static function createOrRefreshUser ( $ username , $ individualGroupAssignmentOptions = null ) { if ( static :: getExtensionOptions ( 'ENABLE_YII2_PROFILING' ) == true ) { Yii :: beginProfile ( 'createOrRefreshUser' , static :: YII2_PROFILE_NAME . 'createOrRefreshUser' ) ; } $ userObjectDb = static :: findOne ( [ 'username' => $ username ] ) ; //Create user if not found in db
 if ( $ userObjectDb == null ) { $ userObjectDb = static :: createNewUser ( $ username , $ individualGroupAssignmentOptions ) ; } else { $ userObjectDb -> setIndividualGroupAssignmentOptions ( $ individualGroupAssignmentOptions ) ; $ userObjectDb -> updateAccountStatus ( ) ; $ userObjectDb -> updateGroupAssignment ( ) ; } if ( static :: getExtensionOptions ( 'ENABLE_YII2_PROFILING' ) == true ) { Yii :: endProfile ( 'createOrRefreshUser' , static :: YII2_PROFILE_NAME . 'createOrRefreshUser' ) ; } return $ userObjectDb ; }
Check if a user exists. If the user exists the account status and group assigments are refreshed.
Otherwise a new user is created.

@param string $username
@param array $individualGroupAssignmentOptions
@return Edvlerblog\Adldap2\model\UserDbLdap object. Null if the username is not found in LDAP.
Check if a user exists . If the user exists the account status and group assigments are refreshed . Otherwise a new user is created .