Retrieve the list of allowed approver email addresses.
171817
def retrieve_approver_email_list(self, domain, product_id):
        """"""

        response = self.request(E.retrieveApproverEmailListSslCertRequest(
            E.domain(domain),
            E.productId(product_id)
        ))

        return [str(i) for i in response.data.array[0].item]
10322
def GetNonExpiredApprovers(self):
    """"""

    lifetime = rdfvalue.Duration(
        self.Get(self.Schema.LIFETIME) or config.CONFIG["ACL.token_expiry"])

    # Check that there are enough approvers.
    #
    # TODO(user): approvals have to be opened with
    # age=aff4.ALL_TIMES because versioning is used to store lists
    # of approvers. This doesn't seem right and has to be fixed.
    approvers = set()
    now = rdfvalue.RDFDatetime.Now()
    for approver in self.GetValuesForAttribute(self.Schema.APPROVER):
      if approver.age + lifetime > now:
        approvers.add(utils.SmartStr(approver))

    return list(approvers)
99268
public function getCustomerByEmail(string $email) : array
    {
        Assert::that($email)->email();

        return (array)$this->master->doRequest(
            'GET',
            sprintf('/admin/WEBAPI/Endpoints/v1_0/CustomerService/{KEY}/GetCustomerByEmail?email=%s', rawurlencode($email))
        );
    }
55597
def valid_email(emailaddress, domains=GENERIC_DOMAINS):
    """"""

    # Email address must be at least 6 characters in total.
    # Assuming noone may have addresses of the type a@com
    if len(emailaddress) < 6:
        return False  # Address too short.

    # Split up email address into parts.
    try:
        localpart, domainname = emailaddress.rsplit('@', 1)
        host, toplevel = domainname.rsplit('.', 1)
    except ValueError:
        return False  # Address does not have enough parts.

    # Check for Country code or Generic Domain.
    if len(toplevel) != 2 and toplevel not in domains:
        return False  # Not a domain name.

    for i in '-_.%+.':
        localpart = localpart.replace(i, "")
    for i in '-_.':
        host = host.replace(i, "")

    if localpart.isalnum() and host.isalnum():
        return True  # Email address is fine.
    else:
        return False
1124556
def lookup(self, query=''):
        """"""
        res = []
        query = re.compile('.*%s.*' % re.escape(query), self.reflags)
        for name, email in self.get_contacts():
            if query.match(name) or query.match(email):
                res.append((name, email))
        return res
580885
def recipients(self):
        
        return [email for email in (self.to + self.cc + self.bcc) if email]
761392
def mails(element_key, options = {})
      parameter = { query: options }
      parameter[:basic_auth] = @auth

      response = self.class.get("/elements/#{element_key}/mails", parameter)
      return response['ElementList'] if response.success?
    end
1333356
def CheckEmails(self, checkTypo=False, fillWrong=True):
        ''''''
        self.wrong_emails = []
        for email in self.emails:
            if self.CheckEmail(email, checkTypo) is False:
                self.wrong_emails.append(email)
933029
public function emailsComeFromListOfApprovedSenders($emailAddress) {

        // are we checking that inbound emails come from a pre-approved list of senders?
        if (!$this->isInboundEmailsFromAllowedSendersOnly()) {

            // we are *not* checking that emails come from a pre-approved list of senders
            return true;
        }

        // yes, we are checking that emails come from a pre-approved list of senders
        if ($this->isInboundEmailsFromAllowedSendersOnlyListOfSsenders($emailAddress)) {

            // the sender is, indeed, on the list of pre-approved senders
            return true;
        }

        // the sender is not on the list of pre-approved senders
        return false;
    }
39324
def contacts_getPublicList(user_id):
    """"""
    method = 'flickr.contacts.getPublicList'
    data = _doget(method, auth=False, user_id=user_id)
    if isinstance(data.rsp.contacts.contact, list):
        return [User(user.nsid, username=user.username) \
                for user in data.rsp.contacts.contact]
    else:
        user = data.rsp.contacts.contact
        return [User(user.nsid, username=user.username)]
455954
protected function user_emails()
    {
        $addresses = $this->rc->user->list_emails();

        foreach ($addresses as $idx => $email) {
            $addresses[$idx] = $email['email'];
        }

        $addresses = array_unique($addresses);
        sort($addresses);

        return $addresses;
    }
369790
def attended_by(self, email):
        
        for attendee in self["attendees"] or []:
            if (attendee["email"] == email
                    and attendee["responseStatus"] == "accepted"):
                return True
        return False
1210717
def _get_addresses(self, address_data, retain_name=False):
        
        if retain_name:
            raise NotImplementedError(
                "Not yet implemented, but will need client-code changes too"
            )

        # We trust than an email address contains an "@" after
        # email.utils.getaddresses has done the hard work. If we wanted
        # to we could use a regex to check for greater email validity

        # NB: getaddresses expects a list, so ensure we feed it appropriately
        if isinstance(address_data, str):
            if "[" not in address_data:
                # Definitely turn these into a list
                # NB: this is pretty assumptive, but still prob OK
                address_data = [address_data]

        output = [x[1] for x in getaddresses(address_data) if "@" in x[1]]
        return output
421971
def checkBanlist(sender, **kwargs):
    '''
    
    '''

    if not getConstant('registration__enableBanList'):
        return

    logger.debug('Signal to check RegistrationContactForm handled by banlist app.')

    formData = kwargs.get('formData', {})
    first = formData.get('firstName')
    last = formData.get('lastName')
    email = formData.get('email')

    request = kwargs.get('request', {})
    session = getattr(request, 'session', {}).get(REG_VALIDATION_STR, {})
    registrationId = getattr(kwargs.get('registration', None), 'id', None)

    records = BannedPerson.objects.exclude(
        disabled=True
    ).exclude(
        expirationDate__lte=timezone.now()
    ).filter(
        (Q(firstName__iexact=first) & Q(lastName__iexact=last)) |
        Q(bannedemail__email__iexact=email)
    )

    if not records.exists():
        return

    # Generate an "error code" to reference so that it is easier to lookup
    # the record on why they were flagged.
    flagCode = ''.join(random.choice(string.ascii_uppercase) for x in range(8))
    ip = get_client_ip(request)
    respondTo = getConstant('registration__banListContactEmail') or getConstant('contact__businessEmail')

    for record in records:
        flagRecord = BanFlaggedRecord.objects.create(
            flagCode=flagCode,
            person=record,
            ipAddress=ip,
            data={'session': session, 'formData': formData, 'registrationId': registrationId}
        )

    notify = getConstant('registration__banListNotificationEmail')
    if notify:
        send_from = getConstant('contact__businessEmail')
        subject = _('Notice of attempted registration by banned individual')
        message = _(
            'This is an automated notification that the following individual has attempted ' +
            'to register for a class series or event:\n\n' +
            'Name: %s\n' % record.fullName +
            'Email: %s\n' % email +
            'Date/Time: %s\n' % flagRecord.dateTime +
            'IP Address: %s\n\n' % ip +
            'This individual has been prevented from finalizing their registration, and they ' +
            'have been asked to notify the school at %s with code %s to proceed.' % (respondTo, flagCode)
        )

        sendEmail(subject, message, send_from, to=[notify])

    message = ugettext('There appears to be an issue with this registration. '
                       'Please contact %s to proceed with the registration process. '
                       'You may reference the error code %s.' % (respondTo, flagCode))

    if request.user.has_perm('banlist.ignore_ban'):
        messages.warning(request, message)

    else:
        raise ValidationError(message)
1366685
def ParseYAMLAuthorizationsList(yaml_data):
    """"""
    try:
      raw_list = yaml.ParseMany(yaml_data)
    except (ValueError, pyyaml.YAMLError) as e:
      raise InvalidAPIAuthorization("Invalid YAML: %s" % e)

    result = []
    for auth_src in raw_list:
      auth = APIAuthorization()
      auth.router_cls = _GetRouterClass(auth_src["router"])
      auth.users = auth_src.get("users", [])
      auth.groups = auth_src.get("groups", [])
      auth.router_params = auth_src.get("router_params", {})

      result.append(auth)

    return result
1021982
def SplitEmailsAndAppendEmailDomain(self, address_list):
    """"""
    result = []
    # Process email addresses, and build up a list.
    if isinstance(address_list, rdf_standard.DomainEmailAddress):
      address_list = [str(address_list)]
    elif isinstance(address_list, string_types):
      address_list = [address for address in address_list.split(",") if address]
    for address in address_list:
      result.append(self.AddEmailDomain(address))
    return result
1031144
function getDomainList(data) {
  var domains = [];

  _.each(data.emails, function(emailObject) {
    domains.push(emailObject.value.split('@')[1]);
  });

  return domains;
}