Exemple #1
0
def delete_group(groupname):
    if groupname in manager.GROUPS:
        manager.delete_group(groupname)
        msg = 'Deleted group %s' % groupname
        return jsonify(dict(status=200, message=msg))
    else:
        return manager.error_404('Group not found: %s' % groupname)
Exemple #2
0
def put_group(groupname):
    if groupname in manager.GROUPS:
        user_list = request.get_json()
        manager.add_to_group(groupname, user_list)
        return jsonify({groupname: manager.GROUPS[groupname]})
    else:
        return manager.error_404('Group not found: %s' % groupname)
Exemple #3
0
def delete_user(userid):
    if userid in manager.USERS:
        manager.delete_user(userid)
        msg = 'Deleted user %s' % userid
        return jsonify(dict(status=200, message=msg))
    else:
        return manager.error_404('User not found: %s' % userid)
Exemple #4
0
def get_group(groupname):
    if groupname in manager.GROUPS:
        return Response(json.dumps((manager.GROUPS[groupname])),
                        mimetype='application/json')
    else:
        return manager.error_404('Group not found: %s' % groupname)
Exemple #5
0
def get_user(userid):
    if userid in manager.USERS:
        return jsonify(manager.USERS[userid])
    else:
        msg = 'User not found: %s' % userid
        return manager.error_404(msg)