Esempio n. 1
0
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)}
Esempio n. 2
0
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)}
Esempio n. 3
0
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)}
Esempio n. 4
0
def removeContactUser(uuid):
    usr = getUser(uuid)
    usr.locked = False
    logEntry('User no longer contact: {}'.format(usr.uuid), table='user')
    db.session.commit()
Esempio n. 5
0
def setContactUser(uuid):
    usr = getUser(uuid)
    usr.locked = True
    logEntry('User now contact: {}'.format(usr.uuid), table='user')
    db.session.commit()