예제 #1
0
파일: __init__.py 프로젝트: di445/server
    def can_cross_empty_bridge(self):
        bridge_name = "balrog"
        filter_type = "all-users"

        bridge = GandalfBridge.get_or_insert(bridge_name)

        return gandalf(bridge_name)
예제 #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)
예제 #3
0
파일: __init__.py 프로젝트: di445/server
    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)
예제 #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)
예제 #5
0
파일: __init__.py 프로젝트: di445/server
    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)
예제 #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)
예제 #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))
예제 #8
0
파일: api.py 프로젝트: 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))
예제 #9
0
    def can_cross_empty_bridge(self):
        bridge_name = "balrog"

        GandalfBridge.get_or_insert(bridge_name)

        return gandalf(bridge_name)