def confirmUser(uuid, tenant_uuid): try: usr = user.query.filter_by(uuid=uuid, tenant_uuid=tenant_uuid).first() usr.confirmed = True db.session.commit() logEntry('User confirmed: {}'.format(usr.uuid), table='user') return {'success':'User confirmed'} except Exception as E: errorLog(unicode(E), table='user') return {'error':unicode(E)}
def activateUser(uuid): try: usr = getUser(uuid) usr.active = True db.session.commit() logEntry('User activated: {}'.format(usr.uuid), table='user') return {'success': 'User has been activated'} except Exception as E: errorLog(unicode(E), table='user') return {'error':unicode(E)}
def unlockUser(uuid): try: usr = getUser(uuid) req = authAPI(endpoint='unlockUser/'+unicode(uuid), method='put', token=session['token']) if 'success' in req: try: usr.locked = False db.session.commit() logEntry('User unlocked: {}'.format(usr.uuid), table='user') return {'success': 'User can now use the system again'} except Exception as E: errorLog(unicode(E), table='user') return {'error':unicode(E)} else: errorLog(req['error'], table='user') return {'error': req['error']} except Exception as E: errorLog(unicode(E), table='user') return {'error':unicode(E)}
def removeContactUser(uuid): usr = getUser(uuid) usr.locked = False logEntry('User no longer contact: {}'.format(usr.uuid), table='user') db.session.commit()
def setContactUser(uuid): usr = getUser(uuid) usr.locked = True logEntry('User now contact: {}'.format(usr.uuid), table='user') db.session.commit()