lib.sqlalchemy.get_admin_contacts_for_organization - python examples

Here are the examples of the python api lib.sqlalchemy.get_admin_contacts_for_organization taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 View Complete Implementation : smtp.py
Copyright GNU General Public License v3.0
Author : lavalamp-
@websight_app.task(bind=True, base=DatabaseTask)
def send_emails_for_org_user_invite(
        self,
        org_uuid=None,
        org_name=None,
        user_uuid=None,
        user_name=None,
        user_email=None,
        user_is_new=False,
):
    """
    Handle the sending of emails as a result of the given user being granted access to the given
    organization.
    :param org_uuid: The UUID of the organization that the user was added to.
    :param org_name: The name of the organization that the user was added to.
    :param user_uuid: The UUID of the user that was added.
    :param user_name: The name of the user that was added.
    :param user_email: The email address of the user that was added.
    :param user_is_new: Whether or not the user was created by the invitation process, or if the
    user already existed.
    :return: None
    """
    logger.info(
        "Now handling sending emails for user %s invitation to organization %s."
        % (user_uuid, org_uuid)
    )
    smtp_helper = SmtpEmailHelper.instance()
    if user_is_new:
        activation_token = get_user_activation_token(user_uuid=user_uuid, db_session=self.db_session)
        smtp_helper.send_email_for_new_user_org_invite(
            activation_token=activation_token,
            org_name=org_name,
            org_uuid=org_uuid,
            user_email=user_email,
            user_uuid=user_uuid,
        )
    else:
        smtp_helper.send_email_for_user_org_invite(
            user_name=user_name,
            user_email=user_email,
            org_name=org_name,
            org_uuid=org_uuid,
        )
    org_admin_contacts = get_admin_contacts_for_organization(db_session=self.db_session, org_uuid=org_uuid)
    smtp_helper.send_admin_emails_for_user_invite(
        org_uuid=org_uuid,
        org_name=org_name,
        invited_user_email=user_email,
        invited_user_name=user_name,
        admin_contact_tuples=org_admin_contacts,
    )