Ejemplo n.º 1
0
    def enable(self, request, **kwargs):
        self.method_check(request, allowed=['get'])
        self.is_authenticated(request)
        self.throttle_check(request)

        status = PluginManager.enablePlugin(plugin_pk=kwargs['pk'])
        self.log_throttled_access(request)
        ClientFactory.SchedReload()
        ClientFactory.LisaReload()
        return self.create_response(request, status, HttpAccepted)
Ejemplo n.º 2
0
    def install(self, request, **kwargs):
        self.method_check(request, allowed=['post','get'])
        self.is_authenticated(request)
        self.throttle_check(request)
        plugin_name = kwargs['plugin_name']
        status = PluginManager.installPlugin(plugin_name=plugin_name)

        self.log_throttled_access(request)
        ClientFactory.SchedReload()
        ClientFactory.LisaReload()
        return self.create_response(request, status, HttpCreated)
Ejemplo n.º 3
0
Archivo: api.py Proyecto: gdumee/LISA
    def speak(self, request, **kwargs):
        self.method_check(request, allowed=['post', 'get'])
        self.is_authenticated(request)
        self.throttle_check(request)

        from tastypie.http import HttpAccepted, HttpNotModified

        if request.POST:
            message = request.POST.get("message")
            clients_zone = request.POST.getlist("clients_zone")
        else:
            message = request.GET.get("message")
            clients_zone = request.GET.getlist("clients_zone")
        jsondata = {'message': message, 'type': "chat"}
        zone_uids = []
        for z in clients_zone:
            zone_uids.append(ClientFactory.getOrCreateZone(z))
        ClientFactory.sendToClients(jsondata = jsondata, zone_uids = zone_uids)

        self.log_throttled_access(request)
        return self.create_response(request, { 'status': 'success', 'log': "Message sent"}, HttpAccepted)
Ejemplo n.º 4
0
Archivo: api.py Proyecto: gdumee/LISA
    def speak(self, request, **kwargs):
        self.method_check(request, allowed=['post', 'get'])
        self.is_authenticated(request)
        self.throttle_check(request)

        from tastypie.http import HttpAccepted, HttpNotModified

        if request.POST:
            message = request.POST.get("message")
            clients_zone = request.POST.getlist("clients_zone")
        else:
            message = request.GET.get("message")
            clients_zone = request.GET.getlist("clients_zone")
        jsondata = {'message': message, 'type': "chat"}
        zone_uids = []
        for z in clients_zone:
            zone_uids.append(ClientFactory.getOrCreateZone(z))
        ClientFactory.sendToClients(jsondata=jsondata, zone_uids=zone_uids)

        self.log_throttled_access(request)
        return self.create_response(request, {
            'status': 'success',
            'log': "Message sent"
        }, HttpAccepted)
Ejemplo n.º 5
0
Archivo: api.py Proyecto: gdumee/LISA
    def engine_reload(self, request, **kwargs):
        self.method_check(request, allowed=['get'])
        self.is_authenticated(request)
        self.throttle_check(request)

        from tastypie.http import HttpAccepted, HttpNotModified

        try:
            ClientFactory.LisaReload()
        except:
            log.err()
            return self.create_response(request, {'status': 'failure'},
                                        HttpNotModified)
        self.log_throttled_access(request)
        return self.create_response(request, {
            'status': 'success',
            'log': "Demonstrator Engine reloaded"
        }, HttpAccepted)