Example #1
0
def delete_user_data():
    usermail = g.user.mail
    fas_user = queries.get_user_by_mail(db, usermail).first()
    bz_user = queries.get_bz_user(db, usermail)
    contact_email = queries.get_contact_email(db, usermail)

    if bz_user is not None:
        anonymous = create_anonymous_bzuser(db, uid=-1)
        delete_bugzilla_user(db, bz_user.id, anonymous.id)
        db.session.delete(bz_user)

    if fas_user is not None:
        queries.get_reportarchives_by_username(db, fas_user.username).delete(False)
        queries.get_problemreassigns_by_username(db, fas_user.username).delete(False)

    if contact_email is not None:
        queries.get_reportcontactmails_by_id(db, contact_email.id).delete(False)
        db.session.delete(contact_email)

    # Sign out user before deleting his account
    session.pop("openid", None)
    flash(u"You were signed out.", category='info')
    db.session.delete(fas_user)
    db.session.commit()

    return redirect(oid.get_next_url())
Example #2
0
File: user.py Project: abrt/faf
 def contact_mails(self):
     contact_mail = queries.get_contact_email(self.db, self.mail)
     if contact_mail:
         reports = queries.get_reportcontactmails_by_id(self.db, contact_mail.id).all()
         return {"Contact Mail" : self.mail,
                 "Reports" : [get_url("reports", report.report_id) for report in reports]}
     return {}
Example #3
0
 def contact_mails(self):
     contact_mail = queries.get_contact_email(self.db, self.mail)
     if contact_mail:
         reports = queries.get_reportcontactmails_by_id(
             self.db, contact_mail.id).all()
         return {
             "Contact Mail":
             self.mail,
             "Reports":
             [get_url("reports", report.report_id) for report in reports]
         }
     return {}