##// END OF EJS Templates
forks: don't expose fork link if we don't have permission to read it, and also don't pre-select in pull request.
marcink -
r3367:2e466d45 default
parent child Browse files
Show More
@@ -249,6 +249,12 b' class RepoAppView(BaseAppView):'
249 else: # redirect if we don't show missing requirements
249 else: # redirect if we don't show missing requirements
250 raise HTTPFound(h.route_path('home'))
250 raise HTTPFound(h.route_path('home'))
251
251
252 c.has_origin_repo_read_perm = False
253 if self.db_repo.fork:
254 c.has_origin_repo_read_perm = h.HasRepoPermissionAny(
255 'repository.write', 'repository.read', 'repository.admin')(
256 self.db_repo.fork.repo_name, 'summary fork link')
257
252 return c
258 return c
253
259
254 def _get_f_path_unchecked(self, matchdict, default=None):
260 def _get_f_path_unchecked(self, matchdict, default=None):
@@ -755,7 +755,7 b' class RepoPullRequestsView(RepoAppView, '
755
755
756 default_target_repo = source_repo
756 default_target_repo = source_repo
757
757
758 if source_repo.parent:
758 if source_repo.parent and c.has_origin_repo_read_perm:
759 parent_vcs_obj = source_repo.parent.scm_instance()
759 parent_vcs_obj = source_repo.parent.scm_instance()
760 if parent_vcs_obj and not parent_vcs_obj.is_empty():
760 if parent_vcs_obj and not parent_vcs_obj.is_empty():
761 # change default if we have a parent repo
761 # change default if we have a parent repo
@@ -855,6 +855,7 b' class RepoPullRequestsView(RepoAppView, '
855 all_target_repos = target_repos + parent_target_repos
855 all_target_repos = target_repos + parent_target_repos
856
856
857 repos = []
857 repos = []
858 # This checks permissions to the repositories
858 for obj in ScmModel().get_repos(all_target_repos):
859 for obj in ScmModel().get_repos(all_target_repos):
859 repos.append({
860 repos.append({
860 'id': obj['name'],
861 'id': obj['name'],
@@ -188,7 +188,7 b''
188 %if repo_instance.fork:
188 %if repo_instance.fork:
189 <p>
189 <p>
190 <i class="icon-code-fork"></i> ${_('Fork of')}
190 <i class="icon-code-fork"></i> ${_('Fork of')}
191 <a href="${h.route_path('repo_summary',repo_name=repo_instance.fork.repo_name)}">${repo_instance.fork.repo_name}</a>
191 ${h.link_to_if(c.has_origin_repo_read_perm,repo_instance.fork.repo_name, h.route_path('repo_summary', repo_name=repo_instance.fork.repo_name))}
192 </p>
192 </p>
193 %endif
193 %endif
194
194
General Comments 0
You need to be logged in to leave comments. Login now