示例#1
0
    def is_allowed_scheme(self, system):
        if not conf.use_protocol_check:
            return True

        protos = ProtocolManager(self.environment_key)
        scheme = self.req.construct_url('/').split(':')[0]
        return protos.is_protocol_allowed(scheme, system)
示例#2
0
    def is_allowed_scheme(self, system):
        if not conf.use_protocol_check:
            return True

        protos = ProtocolManager(self.environment_key)
        scheme = self.req.construct_url('/').split(':')[0]
        return protos.is_protocol_allowed(scheme, system)
示例#3
0
    def _show_panel(self, req, protos, scm_type):
        data = {'available_scm_protocols': ProtocolManager.available_schemes(scm_type),
                'available_dav_protocols': ProtocolManager.available_schemes('dav'),
                'allowed_scm_protocols': protos.allowed_protocols(scm_type),
                'allowed_dav_protocols': protos.allowed_protocols('dav'),
                'protos': ProtocolManager.protocols.keys()}

        return 'admin_protocols.html', data
示例#4
0
    def protocols(self, project_id, scm):
        protocol_manager = ProtocolManager(project_id)
        allowed = protocol_manager.allowed_protocols(scm)

        schemes = []
        for proto in ProtocolManager.available_schemes(scm):
            if proto in allowed:
                schemes.append(proto)
        return schemes
示例#5
0
    def protocols(self, project_id, scm):
        protocol_manager = ProtocolManager(project_id)
        allowed = protocol_manager.allowed_protocols(scm)

        schemes = []
        for proto in ProtocolManager.available_schemes(scm):
            if proto in allowed:
                schemes.append(proto)
        return schemes
示例#6
0
    def _show_panel(self, req, protos, scm_type):
        data = {
            'available_scm_protocols':
            ProtocolManager.available_schemes(scm_type),
            'available_dav_protocols':
            ProtocolManager.available_schemes('dav'),
            'allowed_scm_protocols': protos.allowed_protocols(scm_type),
            'allowed_dav_protocols': protos.allowed_protocols('dav'),
            'protos': ProtocolManager.protocols.keys()
        }

        return 'admin_protocols.html', data
示例#7
0
    def render_admin_panel(self, req, cat, page, path_info):
        req.perm.require('TRAC_ADMIN')

        protos = ProtocolManager(Project.get(self.env).id)
        scm_type = self.env.config.get('trac', 'repository_type')

        if req.method == 'POST':
            self._process_changes(req, protos, scm_type)

        return self._show_panel(req, protos, scm_type)