code: public function updateAccountStatus() {
          if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
              Yii::beginProfile('LDAP updateAccountStatus function', static::YII2_PROFILE_NAME . 'updateAccountStatus');
          }
          
          $ldapUser = $this->queryLdapUserObject();
          
          if ($ldapUser == null) {
              //If no user is found in LDAP, disable in database.
              $this->status = static::STATUS_DISABLED;
          } else {
              //Query account status from active directory
              $ldapAccountState = $ldapUser->getUserAccountControl();
  
              $disabledUser = ($ldapAccountState & AccountControl::ACCOUNTDISABLE) === AccountControl::ACCOUNTDISABLE;
              $lockedUser = ($ldapAccountState & AccountControl::LOCKOUT) === AccountControl::LOCKOUT;
              $pwExpired = ($ldapAccountState & AccountControl::PASSWORD_EXPIRED) === AccountControl::PASSWORD_EXPIRED;
  
              if($disabledUser == true || $lockedUser == true || $pwExpired == true) {
                  $this->status = static::STATUS_DISABLED;
              } else {
                  $this->status = static::STATUS_ENABLED;
              }
          }
          
          $this->save();
          
          if(static::getExtensionOptions('ENABLE_YII2_PROFILING') == true) {
              Yii::endProfile('LDAP updateAccountStatus function', static::YII2_PROFILE_NAME . 'updateAccountStatus');
          }
          
          return $this->status;
      }
docs: Query LDAP for the current user status and save the information to database.
  
  @return int Status after update