Ejemplo n.º 1
0
    def can_cross_empty_bridge(self):
        bridge_name = "balrog"
        filter_type = "all-users"

        bridge = GandalfBridge.get_or_insert(bridge_name)

        return gandalf(bridge_name)
Ejemplo n.º 2
0
    def can_cross_empty_bridge(self):
        bridge_name = "balrog"
        filter_type = "all-users"

        bridge = GandalfBridge.get_or_insert(bridge_name)

        return gandalf(bridge_name)
Ejemplo n.º 3
0
    def can_cross_all_users_blacklist(self):
        bridge_name = "balrog"
        filter_type = "all-users"

        bridge = GandalfBridge.get_or_insert(bridge_name)

        GandalfFilter(bridge=bridge, filter_type=filter_type, whitelist=False).put()

        return gandalf(bridge_name)
Ejemplo n.º 4
0
    def can_cross_all_users_blacklist(self):
        bridge_name = "balrog"
        filter_type = "all-users"

        bridge = GandalfBridge.get_or_insert(bridge_name)

        GandalfFilter(bridge=bridge, filter_type=filter_type, whitelist=False).put()

        return gandalf(bridge_name)
Ejemplo n.º 5
0
    def can_cross_all_users_outside_percentage(self):
        bridge_name = "balrog"
        filter_type = "all-users"

        bridge = GandalfBridge.get_or_insert(bridge_name)

        filter = GandalfFilter(bridge=bridge, filter_type=filter_type, whitelist=True)
        filter.put()

        identity_percentage = BridgeFilter._identity_percentage(filter.key())

        filter.percentage = identity_percentage
        filter.put()

        return gandalf(bridge_name)
Ejemplo n.º 6
0
    def can_cross_all_users_outside_percentage(self):
        bridge_name = "balrog"
        filter_type = "all-users"

        bridge = GandalfBridge.get_or_insert(bridge_name)

        filter = GandalfFilter(bridge=bridge, filter_type=filter_type, whitelist=True)
        filter.put()

        identity_percentage = BridgeFilter._identity_percentage(filter.key())

        filter.percentage = identity_percentage
        filter.put()

        return gandalf(bridge_name)
Ejemplo n.º 7
0
    def post(self):

        if not can_control_gandalf():
            return

        action = self.request.get('action')
        bridge_name = self.request.get('bridge_name')

        if not bridge_name:
            raise Exception("Must include 'bridge_name' parameter")

        bridge = GandalfBridge.get_or_insert(bridge_name)

        if action == 'delete':
            bridge.delete()

        context = {
            "success": True,
        }

        self.response.headers["Content-Type"] = "application/json"
        self.response.out.write(jsonify(context))
Ejemplo n.º 8
0
Archivo: api.py Proyecto: di445/server
    def post(self):

        if not can_control_gandalf():
            return

        action = self.request.get('action')
        bridge_name = self.request.get('bridge_name')

        if not bridge_name:
            raise Exception("Must include 'bridge_name' parameter")

        bridge = GandalfBridge.get_or_insert(bridge_name)

        if action == 'delete':
            bridge.delete()

        context = {
            "success": True,
        }

        self.response.headers["Content-Type"] = "application/json"
        self.response.out.write(jsonify(context))
Ejemplo n.º 9
0
    def can_cross_empty_bridge(self):
        bridge_name = "balrog"

        GandalfBridge.get_or_insert(bridge_name)

        return gandalf(bridge_name)