Ejemplo n.º 1
0
def get_add_rights_json():
    DA= DataAccess()
    game_owner = DA.getGameOwner(request.args.get('game_id', 0, type=str))
    user = request.args.get('user_id', 0, type=str)
    #print game_owner
    #print user
    rightsList = {}
    rightsList[0] = {}
    if user == game_owner:
        #print 'user is owner'
        rightsList[0]['can_add'] = 'Y'
    else:
        #print 'user not owner'
        rightsList[0]['can_add'] = 'N'

    return jsonify(rightsList)
Ejemplo n.º 2
0
def get_game_room_json():
    DA= DataAccess()
    characters = DA.getGameCharacters(request.args.get('game_id', 0, type=str))
    game_owner = DA.getGameOwner(request.args.get('game_id', 0, type=str))
    user = request.args.get('user_id', 0, type=str)
    #print game_owner
    #print user
    charList = {}

    for char in characters:
        charList[char.id] = {}
        charList[char.id]['owner_id'] = char.user_id
        charList[char.id]['char_name'] = char.name
        charList[char.id]['char_id'] = char.id
        if user == char.user_id:
            charList[char.id]['can_edit'] = 'Y'
        else:
            charList[char.id]['can_edit'] = 'N'
        if user == game_owner:
            charList[char.id]['can_remove'] = 'Y'
        else:
            charList[char.id]['can_remove'] = 'N'

    return jsonify(charList)