Beispiel #1
0
def getAll():
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)

    users = quickAccess.load(listFile)

    print '%sreturn: %s%s' % (settings.color.YELLOW, users, settings.color.ENDC)
    return users
Beispiel #2
0
def getByAuthor(author):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    tickets = quickAccess.load(listFile)

    tickets = [x for x in tickets if x[4] == author]

    print '%sreturn: %s%s' % (settings.color.YELLOW, tickets, settings.color.ENDC)
    return tickets
Beispiel #3
0
def getById(id):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    tickets = quickAccess.load(listFile)

    tickets = [x for x in tickets if x[1] == id]
    ticket = []
    if tickets:
        ticket = tickets[0]

    print '%sreturn: %s%s' % (settings.color.YELLOW, ticket, settings.color.ENDC)
    return ticket
Beispiel #4
0
def remove(id):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    tickets = quickAccess.load(listFile)

    ticket = getById(id)
    tickets.remove(ticket)

    quickAccess.unload(listFile, tickets)

    print '%sreturn: %s%s' % (settings.color.YELLOW, ticket, settings.color.ENDC)
    return ticket
def getByTicketId(ticketId):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    comments = quickAccess.load(listFile)

    comments = [x for x in comments if x[0] == ticketId]
    comment = []
    if comments:
        comment = comments[0]

    print '%sreturn: %s%s' % (settings.color.YELLOW, comment, settings.color.ENDC)
    return comment
def remove(ticketId):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    comments = quickAccess.load(listFile)

    comment = getByTicketId(ticketId)
    comments.remove(comment)

    quickAccess.unload(listFile, comments)

    print '%sreturn: %s%s' % (settings.color.YELLOW, comment, settings.color.ENDC)
    return comment
def getByTicketId(ticketId):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    descriptions = quickAccess.load(listFile)

    descriptions = [x for x in descriptions if x[0] == ticketId]
    description = []
    if descriptions:
        description = descriptions[0]

    print '%sreturn: %s%s' % (settings.color.YELLOW, description, settings.color.ENDC)
    return description
def remove(ticketId):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    descriptions = quickAccess.load(listFile)

    description = getByTicketId(ticketId)
    descriptions.remove(description)

    quickAccess.unload(listFile, descriptions)

    print '%sreturn: %s%s' % (settings.color.YELLOW, description, settings.color.ENDC)
    return description
Beispiel #9
0
def getInfo(userId):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)

    users = quickAccess.load(listFile)
    users = [x for x in users if x[0] == userId]
    user = []

    if users:
        user = users[0]

    print '%sreturn: %s%s' % (settings.color.YELLOW, user, settings.color.ENDC)
    return user
Beispiel #10
0
def create(ticketId, comment):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    comments = quickAccess.load(listFile)

    timestamp = settings.timestamp()
    comment = [ticketId, comment, timestamp]
    comments.append(comment)

    quickAccess.unload(listFile, comments)

    print '%sreturn: %s%s' % (settings.color.YELLOW, comment, settings.color.ENDC)
    return comment
def create(ticketId, description):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    descriptions = quickAccess.load(listFile)

    timestamp = settings.timestamp()
    description = [ticketId, description, timestamp]
    descriptions.append(description)

    quickAccess.unload(listFile, descriptions)

    print '%sreturn: %s%s' % (settings.color.YELLOW, description, settings.color.ENDC)
    return description
Beispiel #12
0
def create(id, status, author):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    tickets = quickAccess.load(listFile)

    timestamp = settings.timestamp()
    signature = random.random()
    ticket = [timestamp, id, signature, status, author]
    tickets.append(ticket)

    quickAccess.unload(listFile, tickets)

    userFile = '%s/%s.json' % (usersPath, author)

    tickets = quickAccess.load(userFile)

    tickets.append(ticket)

    quickAccess.unload(userFile, tickets)

    print '%sreturn: %s%s' % (settings.color.YELLOW, ticket, settings.color.ENDC)

    logsModule.createEntry(ticket)

    return ticket
Beispiel #13
0
def create(username, password):
    print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC)
    users = quickAccess.load(listFile)

    userId = len(users)
    timestamp = settings.timestamp()
    password = encryptor.hashPassword(password)
    userId = str(userId)
    user = [userId, username, password, timestamp]
    users.append(user)

    quickAccess.unload(listFile, users)

    userFile = '%s/%s.json' % (usersPath, userId)

    quickAccess.unload(userFile, [])

    print '%sreturn: %s%s' % (settings.color.YELLOW, user, settings.color.ENDC)
    return user