##// END OF EJS Templates
vcs: Minimal change to expose the shadow repository...
vcs: Minimal change to expose the shadow repository Based on my original research, this was the "minimal" starting point. It shows that three concepts are needed for the "repo_name": * From the security standpoint we think of the shadow repository having the same ACL as the target repository of the pull request. This is because the pull request itself is considered to be a part of the target repository. Out of this thought, the variable "acl_repo_name" is used whenever we want to check permissions or when we need the database configuration of the repository. An alternative name would have been "db_repo_name", but the usage for ACL checking is the most important one. * From the web interaction perspective, we need the URL which was originally used to get to the repository. This is because based on this base URL commands can be identified. Especially for Git this is important, so that the commands are correctly recognized. Since the URL is in the focus, this is called "url_repo_name". * Finally we have to deal with the repository on the file system. This is what the VCS layer deal with normally, so this name is called "vcs_repo_name". The original repository interaction is a special case where all three names are the same. When interacting with a pull request, these three names are typically all different. This change is minimal in a sense that it just makes the interaction with a shadow repository barely work, without checking any special constraints yet. This was the starting point for further work on this topic.

File last commit:

r155:bb64dc25 default
r887:175782be default
Show More
show.html
108 lines | 4.4 KiB | text/html | HtmlLexer
## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%def name="robots()">
%if c.gist.gist_type != 'public':
<meta name="robots" content="noindex, nofollow">
%else:
${parent.robots()}
%endif
</%def>
<%def name="title()">
${_('Gist')} &middot; ${c.gist.gist_access_id}
%if c.rhodecode_name:
&middot; ${h.branding(c.rhodecode_name)}
%endif
</%def>
<%def name="breadcrumbs_links()">
${_('Gist')} &middot; ${c.gist.gist_access_id}
/ ${_('URL')}: ${c.gist.gist_url()}
</%def>
<%def name="menu_bar_nav()">
${self.menu_items(active='gists')}
</%def>
<%def name="main()">
<div class="box">
<!-- box / title -->
<div class="title">
${self.breadcrumbs()}
%if c.rhodecode_user.username != h.DEFAULT_USER:
<ul class="links">
<li>
<a href="${h.url('new_gist')}" class="btn btn-primary">${_(u'Create New Gist')}</a>
</li>
</ul>
%endif
</div>
<div class="table">
<div id="files_data">
<div id="codeblock" class="codeblock">
<div class="code-header">
<div class="stats">
%if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
<div class="remove_gist">
${h.secure_form(url('gist', gist_id=c.gist.gist_access_id),method='delete')}
${h.submit('remove_gist', _('Delete'),class_="btn btn-mini btn-danger",onclick="return confirm('"+_('Confirm to delete this Gist')+"');")}
${h.end_form()}
</div>
%endif
<div class="buttons">
## only owner should see that
%if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
${h.link_to(_('Edit'),h.url('edit_gist', gist_id=c.gist.gist_access_id),class_="btn btn-mini")}
%endif
${h.link_to(_('Show as Raw'),h.url('formatted_gist', gist_id=c.gist.gist_access_id, format='raw'),class_="btn btn-mini")}
</div>
<div class="left" >
%if c.gist.gist_type != 'public':
<span class="tag tag-ok disabled">${_('Private Gist')}</span>
%endif
<span> ${c.gist.gist_description}</span>
<span>${_('Expires')}:
%if c.gist.gist_expires == -1:
${_('never')}
%else:
${h.age_component(h.time_to_utcdatetime(c.gist.gist_expires))}
%endif
</span>
</div>
</div>
<div class="author">
<div title="${c.file_last_commit.author}">
${self.gravatar_with_user(c.file_last_commit.author, 16)} - ${_('created')} ${h.age_component(c.file_last_commit.date)}
</div>
</div>
<div class="commit">${h.urlify_commit_message(c.file_last_commit.message,c.repo_name)}</div>
</div>
## iterate over the files
% for file in c.files:
<% renderer = c.render and h.renderer_from_filename(file.path, exclude=['.txt', '.TXT'])%>
<!-- <div id="${h.FID('G', file.path)}" class="stats" >
<a href="${c.gist.gist_url()}">ΒΆ</a>
<b >${file.path}</b>
<div>
${h.link_to(_('Show as raw'),h.url('formatted_gist_file', gist_id=c.gist.gist_access_id, format='raw', revision=file.commit.raw_id, f_path=file.path),class_="btn btn-mini")}
</div>
</div> -->
<div class="code-body textarea text-area editor">
%if renderer:
${h.render(file.content, renderer=renderer)}
%else:
${h.pygmentize(file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
%endif
</div>
%endfor
</div>
</div>
</div>
</div>
</%def>