def lockout(self):
    from app.modules.auth.models import OAuth2Client, OAuth2Grant, OAuth2Token, Code
    self.is_staff = False
    self.is_admin = False
    self.is_active = False
    self.in_reset = False
    self.in_setup = False
    with db.session.begin():
        db.session.merge(self)
    db.session.refresh(self)
    auth_list = []
    auth_list += OAuth2Token.query.filter_by(user_guid=self.guid).all()
    auth_list += OAuth2Grant.query.filter_by(user_guid=self.guid).all()
    auth_list += OAuth2Client.query.filter_by(user_guid=self.guid).all()
    auth_list += Code.query.filter_by(user_guid=self.guid).all()
    for auth_ in auth_list:
        auth_.delete()
    return self
def lockout(self):
    from app.modules.auth.models import OAuth2Client, OAuth2Grant, OAuth2Token, Code
    self.is_staff = False
    self.is_admin = False
    self.is_active = False
    self.in_reset = False
    self.in_setup = False
    with db.session.begin():
        db.session.merge(self)
    db.session.refresh(self)
    auth_list = []
    auth_list += OAuth2Token.query.filter_by(user_guid=self.guid).all()
    auth_list += OAuth2Grant.query.filter_by(user_guid=self.guid).all()
    auth_list += OAuth2Client.query.filter_by(user_guid=self.guid).all()
    auth_list += Code.query.filter_by(user_guid=self.guid).all()
    for auth_ in auth_list:
        auth_.delete()
    return self