def lastuserauth(): Profile.update_from_user(g.user, db.session, type_user=PROFILE_TYPE.PERSON, type_org=PROFILE_TYPE.ORGANIZATION) db.session.commit() return redirect(get_next_url())
def lastuserauth(): # Make profiles for the user's organizations username = g.user.username or g.user.userid profile = Profile.query.filter_by(userid=g.user.userid).first() if profile is None: profile = Profile(userid=g.user.userid, name=g.user.username or g.user.userid, title=g.user.fullname, type=PROFILE_TYPE.PERSON) db.session.add(profile) else: if profile.name != username: profile.name = username if profile.title != g.user.fullname: profile.title = g.user.fullname for org in g.user.organizations_owned(): profile = Profile.query.filter_by(userid=org['userid']).first() if profile is None: profile = Profile(userid=org['userid'], name=org['name'], title=org['title'], type=PROFILE_TYPE.ORGANIZATION) db.session.add(profile) else: if profile.name != org['name']: profile.name = org['name'] if profile.title != org['title']: profile.title = org['title'] db.session.commit() return redirect(get_next_url())
def lastusernotify(user): Profile.update_from_user(user, db.session, type_user=PROFILE_TYPE.PERSON, type_org=PROFILE_TYPE.ORGANIZATION) db.session.commit()