Exemplo n.º 1
0
def get_event(request):
    dbase = Dbase()
    if 'event_uid' in request.POST:
        event_uid = request.POST["event_uid"]
        if event_uid != '':
            event = dbase.get_event(event_uid)
            return Response(json.dumps(eventToDict(event)))
    response = Response()
    response.status = 500
    return response
Exemplo n.º 2
0
def undelete_user(request):
    dbase = Dbase()
    if 'user_uid' in request.POST:
        user_uid = request.POST["user_uid"]
        if dbase.get_user_privelege(get_username()) == 1:
            dbase.reactivate_user(user_uid)
        return Response()
    response = Response()
    response.status = 500
    return response
Exemplo n.º 3
0
def get_cal_events(request):
    dbase = Dbase()
    events = {}
    start = datetime.fromtimestamp(int(request.GET["start"]));
    end = datetime.fromtimestamp(int(request.GET["end"]));
    dbaseEvents = dbase.get_events_between(start,end)
    eventObjects = []
    for e in dbaseEvents:
        eventObjects.append(eventToDict(e))
    return Response(json.dumps(eventObjects))
Exemplo n.º 4
0
def delete_event(request):
    dbase = Dbase()
    if 'event_uid' in request.POST:
        event_uid = request.POST["event_uid"]
        if dbase.get_user_privelege(get_username()) == 1:
            dbase.deactivate_event(event_uid)
        return Response()
    response = Response()
    response.status = 500
    return response
Exemplo n.º 5
0
def deny_user(request):
    dbase = Dbase()
    if 'event_uid' in request.POST and 'user_uid' in request.POST:
        user_uid = request.POST["user_uid"]
        event_uid = request.POST["event_uid"]
        if dbase.get_user_privelege(get_username()) == 1:
            dbase.deny_user_for_event(user_uid, event_uid)
        return Response()
    response = Response()
    response.status = 500
    return response
Exemplo n.º 6
0
def register_user(request):
    dbase = Dbase()
    if 'event_uid' in request.POST:
        username = get_username(request)
        if username != '':
            event_uid = request.POST["event_uid"]
            dbase.register_user_for_event(username, event_uid)
            return Response()
    response = Response()
    response.status = 500
    return response
Exemplo n.º 7
0
def add_user(request):
    dbase = Dbase()

    if 'real_name' in request.POST and 'uid' in request.POST and 'account_level' in request.POST:
        params = request.POST
        real_name = params["real_name"]
        uid = params["uid"]
        account_level = params["account_level"]
        if dbase.get_user_privelege(get_username()) == 2:
            dbase.add_user(real_name, uid, int(uid));

    return Response()
Exemplo n.º 8
0
def add_event(request):
    dbase = Dbase()

    if 'title' in request.POST:
        params = request.POST
        name = params["title"]
        location = params["location"]
        description = params["description"]
        print "start:" + params["start"]
        print "end:" + params["end"]
        #kstart = parse(params["start"])
        #kend = parse(params["end"])
        start = datetime.strptime(params["start"][0:24], '%a %b %d %Y %H:%M:%S')
        end = datetime.strptime(params["end"][0:24], '%a %b %d %Y %H:%M:%S')
        dbase.new_event(name, location, description, start, end);

    return Response()
Exemplo n.º 9
0
def main():
    """SonarQube script data dumper."""
    global datestamp

    # Generate Timestamp for this dump
    datestamp = str(datetime.today())

    # Database initialization
    db = Dbase()
    db.open()

    # Get Project Sonar Components
    components = get_components(sonar_project_key)

    if jsonservice.status_code is not 200:
        print 'Sonarqube connection cannot be resolved'
        quit()

    # Database is truncated to store the new information
    db.truncate(table)

    # Passe all the components to retrieve desired metric values
    for component in components:
        c = AttrDict(component)
        # Get the values for the key
        values = get_metric_values(c.key)
        # Execute the MySQL Query
        db.query(query, values)

    # Close the database connection
    db.close()

    # Print a Happy ending
    print 'Operation finished!!!'
    print 'Values from %d metrics has been updated.' % len(components)
    print 'The timestamp assingned has been' + datestamp
Exemplo n.º 10
0
def main():
    """SonarQube script data dumper."""
    global datestamp

    # Generate Timestamp for this dump
    datestamp = str(datetime.today())

    # Database initialization
    db = Dbase()
    db.open()

    # Get Project Sonar Components
    components = get_components(sonar_project_key)

    if jsonservice.status_code is not 200:
        print 'Sonarqube connection cannot be resolved'
        quit()

    # Database is truncated to store the new information
    db.truncate(table)

    # Passe all the components to retrieve desired metric values
    for component in components:
        c = AttrDict(component)
        # Get the values for the key
        values = get_metric_values(c.key)
        # Execute the MySQL Query
        db.query(query, values)

    # Close the database connection
    db.close()

    # Print a Happy ending
    print 'Operation finished!!!'
    print 'Values from %d metrics has been updated.' % len(components)
    print 'The timestamp assingned has been' + datestamp
Exemplo n.º 11
0
def modify_event(request):
    dbase = Dbase()
    if 'event_uid' in request.POST and dbase.get_user_privelege(get_username()) == 1:
        event_uid = request.POST["event_uid"]
        if 'title' in request.POST:
            dbase.modifyEvent(event_uid, name=request.POST['title'])
        if 'location' in request.POST:
            dbase.modifyEvent(event_uid, location=request.POST['location'])
        if 'description' in request.POST:
            dbase.modifyEvent(event_uid, description=request.POST['description'])
        if 'event_start' in request.POST:
            newstart = parse(params["event_start"])
            dbase.modifyEvent(event_uid, event_start=newstart)
        if 'event_end' in request.POST:
            newend = parse(params["event_end"])
            dbase.modifyEvent(event_uid, event_end=newend)
        if 'event_registration_start' in request.POST:
            new_registration_start = parse(params["event_registration_start"])
            dbase.modifyEvent(event_uid, event_registration_start=new_registration_start)
        if 'event_registration_end' in request.POST:
            new_registration_end = parse(params["event_registration_end"])
            dbase.modifyEvent(event_uid, event_registration_end=new_registration_end)
        if 'event_approval_start' in request.POST:
            new_approval_start = parse(params["event_approval_start"])
            dbase.modifyEvent(event_uid, event_approval_start=new_approval_start)
        if 'event_approval_end' in request.POST:
            new_approval_end = parse(params["event_approval_end"])
            dbase.modifyEvent(event_uid, event_approval_end=new_approval_end)
        return Response()
    response = Response()
    response.status = 500
    return response