docs: def get_users_subscribed_to_discussion(recID, check_authorizations=True):
      """
      Returns the lists of users subscribed to a given discussion.
  
      Two lists are returned: the first one is the list of emails for
      users who can unsubscribe from the discussion, the second list
      contains the emails of users who cannot unsubscribe (for eg. author
      of the document, etc).
  
      Users appear in only one list. If a user has manually subscribed
      to a discussion AND is an automatic recipients for updates, it
      will only appear in the second list.
  
      :param recID: record ID for which we want to retrieve subscribed users
      :param check_authorizations: if True, check again if users are authorized to view comment
      :return tuple (emails1, emails2)
      """
      subscribers_emails = {}
  
      # Get users that have subscribed to this discussion
      query = """SELECT id_user FROM "cmtSUBSCRIPTION" WHERE id_bibrec=%s"""
      params = (recID,)
      res = run_sql(query, params)
      for row in res:
          uid = row[0]
          if check_authorizations:
              user_info = UserInfo(uid)
              (auth_code, auth_msg) = check_user_can_view_comments(
                  user_info, recID)
          else:
              # Don't check and grant access
              auth_code = False
          if auth_code:
              # User is no longer authorized to view comments.
              # Delete subscription
              unsubscribe_user_from_discussion(recID, uid)
          else:
              email = User.query.get(uid).email
              if '@' in email:
                  subscribers_emails[email] = True
  
      # Get users automatically subscribed, based on the record metadata
      collections_with_auto_replies = CFG_WEBCOMMENT_EMAIL_REPLIES_TO.keys()
      for collection in collections_with_auto_replies:
          if recID in get_collection_reclist(collection):
              fields = CFG_WEBCOMMENT_EMAIL_REPLIES_TO[collection]
              for field in fields:
                  emails = get_fieldvalues(recID, field)
                  for email in emails:
                      if not '@' in email:
                          # Is a group: add domain name
                          subscribers_emails[
                              email +
                              '@' +
                              CFG_SITE_SUPPORT_EMAIL.split('@')[1]] = False
                      else:
                          subscribers_emails[email] = False
  
      return ([email for email, can_unsubscribe_p
               in iteritems(subscribers_emails) if can_unsubscribe_p],
              [email for email, can_unsubscribe_p
               in iteritems(subscribers_emails) if not can_unsubscribe_p])