コード例 #1
0
    def _get_vcs_folders(self, req, q, dirname, prefix):
        rm = RepositoryManager(self.env)

        reponame, repos, path = rm.get_repository_by_path(dirname)
        repo_entries = {'text': _('Suggestions'),
                        'children': [],
                        }
        if repos:
            try:
                entries = ({'id': '/' + pathjoin(repos.reponame, e.path),
                           'text': '/' + pathjoin(repos.reponame, e.path),
                           'is_favorite': False
                            }
                           for e in repos.get_node(path).get_entries()
                           if e.can_view(req.perm)
                           and e.name.lower().startswith(prefix)
                           and e.isdir
                           )
                repo_entries['children'].extend(entries)

                if q.endswith('/'):
                    repo_entries['children'].append({'id': q,
                                                     'text': q,
                                                     'is_favorite': False
                                                     }
                                                    )
            except NoSuchNode:
                pass
        return repo_entries
コード例 #2
0
ファイル: svn_authz.py プロジェクト: starworldx/trac
            def check_path(path):
                path = '/' + pathjoin(repos.scope, path)
                if path != '/':
                    path += '/'

                # Allow access to parent directories of allowed resources
                for spath in set(sum((list(authz.get(module, {}))
                                      for module in modules), [])):
                    if spath.startswith(path):
                        result = check_path_0(spath)
                        if result is True:
                            return True

                # Walk from resource up parent directories
                for spath in parent_iter(path):
                    result = check_path_0(spath)
                    if result is not None:
                        return result