def after_create_object(self, role_invite, data, view_kwargs):
        """
        after create object method for role invite links
        :param role_invite:
        :param data:
        :param view_kwargs:
        :return:
        """
        user = User.query.filter_by(email=role_invite.email).first()
        if 'status' in data and data['status'] == 'accepted':
            role = Role.query.filter_by(name=role_invite.role_name).first()
            event = Event.query.filter_by(id=role_invite.event_id).first()
            uer = UsersEventsRoles.query.filter_by(user=user).filter_by(
                event=event).filter_by(role=role).first()
            if not uer:
                uer = UsersEventsRoles(user, event, role)
                save_to_db(uer, 'Role Invite accepted')

        event = Event.query.filter_by(id=role_invite.event_id).first()
        frontend_url = get_settings()['frontend_url']
        link = "{}/events/{}/role-invites/{}" \
            .format(frontend_url, event.id, role_invite.hash)

        send_email_role_invite(role_invite.email, role_invite.role_name, event.name, link)
        if user:
            send_notif_event_role(user, role_invite.role_name, event.name, link, event.id)
예제 #2
0
    def after_create_object(self, role_invite, data, view_kwargs):
        """
        after create object method for role invite links
        :param role_invite:
        :param data:
        :param view_kwargs:
        :return:
        """
        user = User.query.filter_by(email=role_invite.email).first()
        if 'status' in data and data['status'] == 'accepted':
            role = Role.query.filter_by(name=role_invite.role_name).first()
            event = Event.query.filter_by(id=role_invite.event_id).first()
            uer = UsersEventsRoles.query.filter_by(user=user).filter_by(
                event=event).filter_by(role=role).first()
            if not uer:
                uer = UsersEventsRoles(user, event, role)
                save_to_db(uer, 'Role Invite accepted')

        event = Event.query.filter_by(id=role_invite.event_id).first()
        frontend_url = get_settings()['frontend_url']
        link = "{}/events/{}/role-invites/{}" \
            .format(frontend_url, event.id, role_invite.hash)

        send_email_role_invite(role_invite.email, role_invite.role_name,
                               event.name, link)
        if user:
            send_notif_event_role(user, role_invite.role_name, event.name,
                                  link)
예제 #3
0
    def send_invite(self):
        """
        Send mail to invitee
        """
        user = User.query.filter_by(email=self.email).first()
        event = Event.query.filter_by(id=self.event_id).first()
        frontend_url = get_settings()['frontend_url']
        link = f"{frontend_url}/role-invites?token={self.hash}"
        if not has_access('is_coorganizer', event_id=event.id):
            raise ForbiddenError({'source': ''},
                                 "Co-Organizer Access Required")

        send_email_role_invite(self.email, self.role_name, event.name, link)
        if user:
            notify_event_role_invitation(self, user, current_user)
예제 #4
0
    def after_create_object(self, role_invite, data, view_kwargs):
        """
        after create object method for role invite links
        :param role_invite:
        :param data:
        :param view_kwargs:
        :return:
        """
        user = User.query.filter_by(email=role_invite.email).first()
        event = Event.query.filter_by(id=role_invite.event_id).first()
        frontend_url = get_settings()['frontend_url']
        link = "{}/e/{}/role-invites?token={}" \
            .format(frontend_url, event.identifier, role_invite.hash)

        send_email_role_invite(role_invite.email, role_invite.role_name, event.name, link)
        if user:
            send_notif_event_role(user, role_invite.role_name, event.name, link, event.id)