Beispiel #1
0
    def GatherHelpData(self, mr, page_data):
        """Return a dict of values to drive on-page user help.

    Args:
      mr: commonly used info parsed from the request.
      page_data: Dictionary of base and page template data.

    Returns:
      A dict of values to drive on-page user help, to be added to page_data.
    """
        help_data = super(IssueEntry, self).GatherHelpData(mr, page_data)
        dismissed = []
        if mr.auth.user_pb:
            with work_env.WorkEnv(mr, self.services) as we:
                userprefs = we.GetUserPrefs(mr.auth.user_id)
            dismissed = [
                pv.name for pv in userprefs.prefs if pv.value == 'true'
            ]
        is_privileged_domain_user = framework_bizobj.IsPriviledgedDomainUser(
            mr.auth.user_pb.email)
        if (mr.auth.user_id and 'privacy_click_through' not in dismissed):
            help_data['cue'] = 'privacy_click_through'
        elif (mr.auth.user_id and 'code_of_conduct' not in dismissed):
            help_data['cue'] = 'code_of_conduct'

        help_data.update({
            'is_privileged_domain_user':
            ezt.boolean(is_privileged_domain_user),
        })
        return help_data
Beispiel #2
0
 def _CreateUsers(self, cnxn, emails):
     """Create many users in the database."""
     emails = [email.lower() for email in emails]
     ids = [framework_helpers.MurmurHash3_x86_32(email) for email in emails]
     row_values = [(user_id, email,
                    not framework_bizobj.IsPriviledgedDomainUser(email))
                   for (user_id, email) in zip(ids, emails)]
     self.user_tbl.InsertRows(cnxn, ['user_id', 'email', 'obscure_email'],
                              row_values)
     self.user_2lc.InvalidateKeys(cnxn, ids)
Beispiel #3
0
  def GatherHelpData(self, mr, page_data):
    """Return a dict of values to drive on-page user help.

    Args:
      mr: commonly used info parsed from the request.
      page_data: Dictionary of base and page template data.

    Returns:
      A dict of values to drive on-page user help, to be added to page_data.
    """
    help_data = super(IssueEntry, self).GatherHelpData(mr, page_data)
    is_privileged_domain_user = framework_bizobj.IsPriviledgedDomainUser(
        mr.auth.user_pb.email)
    if (mr.auth.user_id and
        'privacy_click_through' not in mr.auth.user_pb.dismissed_cues):
      help_data['cue'] = 'privacy_click_through'

    help_data.update({
        'is_privileged_domain_user': ezt.boolean(is_privileged_domain_user),
        })
    return help_data