<commit_before>import web
import listener
import univention.uldap as ul
from socket_handler import *

urls = (
    '/(.*)', 'test'
)
app = web.application(urls, globals())

class test:
    def GET(self, name):
        name = name.encode('ascii','ignore')
	name_pieces = name.split('/')

        if 'connected_users' == name_pieces[0]:

            listener.setuid(0)
            lo = ul.getBackupConnection()
            users = lo.search('univentionOpenvpnAccount=1')
	    users = map(lambda user: "%s.openvpn" % user[1].get('uid', [None])[0], users)
	    print users
            listener.unsetuid()
            connected_users = userlist()
	    print connected_users

            

	    # nicht verbundene user anhaengen
            for user in users:
                if not any(u['name'] == user for u in connected_users):
                    connected_users.append({'name': user, 'connected': 'False', 'ips': 'N/A', 'recv': 'N/A', 'sent': 'N/A', 'cons': 'N/A', 'cont': 'N/A'})

            return connected_users

        elif 'kill_user' == name_pieces[0]:
            id = name_pieces[1]
            kill_answer = killuser(id)
            return {'message': kill_answer}
        else:
            return {'message': 'unknown command'}<commit_msg>enable cors<commit_after>import json
import web
import listener
import univention.uldap as ul
from socket_handler import *

urls = (
    '/(.*)', 'test'
)
app = web.application(urls, globals())

class test:
    def GET(self, name):
        name = name.encode('ascii','ignore')
	name_pieces = name.split('/')

        if 'connected_users' == name_pieces[0]:

            listener.setuid(0)
            lo = ul.getBackupConnection()
            users = lo.search('univentionOpenvpnAccount=1')
	    users = map(lambda user: "%s.openvpn" % user[1].get('uid', [None])[0], users)
	    print users
            listener.unsetuid()
            connected_users = userlist()
	    print connected_users

            

	    # nicht verbundene user anhaengen
            for user in users:
                if not any(u['name'] == user for u in connected_users):
                    connected_users.append({'name': user, 'connected': 'False', 'realip': '', 'virtips': '', 'recv': '', 'sent': '', 'cons': '', 'cont': ''})

            return 'jsonCallback(' + json.dumps(connected_users) + ');'

        elif 'kill_user' == name_pieces[0]:
            id = name_pieces[1]
            kill_answer = killuser(id)
            return "{'message': kill_answer}"
        else:
            return "{'message': 'unknown command'}"
{'fraction_non_alphanumeric': 0.14816262705238467, 'fraction_numerical': 0.00547302580140735, 'mean_word_length': 2.33203125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2640258', 'n_tokens_mistral': 792, 'n_tokens_neox': 763, 'n_words': 187}