code: def update_user_flags(self, user, claims):
          
          if settings.GROUPS_CLAIM is not None:
              if settings.GROUPS_CLAIM in claims:
                  access_token_groups = claims[settings.GROUPS_CLAIM]
                  if not isinstance(access_token_groups, list):
                      access_token_groups = [access_token_groups, ]
              else:
                  logger.debug("The configured group claim was not found in the access token")
                  access_token_groups = []
  
              for flag, group in settings.GROUP_TO_FLAG_MAPPING.items():
                  if hasattr(user, flag):
                      if group in access_token_groups:
                          value = True
                      else:
                          value = False
                      setattr(user, flag, value)
                      logger.debug("Attribute '{}' for user '{}' was set to '{}'.".format(user, flag, value))
                  else:
                      msg = "User model has no field named '{}'. Check ADFS boolean claims mapping."
                      raise ImproperlyConfigured(msg.format(flag))
  
          for field, claim in settings.BOOLEAN_CLAIM_MAPPING.items():
              if hasattr(user, field):
                  bool_val = False
                  if claim in claims and str(claims[claim]).lower() in ['y', 'yes', 't', 'true', 'on', '1']:
                      bool_val = True
                  setattr(user, field, bool_val)
                  logger.debug('Attribute "{}" for user "{}" was set to "{}".'.format(user, field, bool_val))
              else:
                  msg = "User model has no field named '{}'. Check ADFS boolean claims mapping."
                  raise ImproperlyConfigured(msg.format(field))
docs: Updates user boolean attributes based on the BOOLEAN_CLAIM_MAPPING setting.
  
          Args:
              user (django.contrib.auth.models.User): User model instance
              claims (dict): Claims from the access token