##// 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:

r883:ae526446 default
r887:175782be default
Show More
root.html
173 lines | 7.2 KiB | text/html | HtmlLexer
## -*- coding: utf-8 -*-
<!DOCTYPE html>
<%
c.template_context['repo_name'] = getattr(c, 'repo_name', '')
if hasattr(c, 'rhodecode_db_repo'):
c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}"></script>
<link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
<title>${self.title()}</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<%def name="robots()">
<meta name="robots" content="index, nofollow"/>
</%def>
${self.robots()}
<link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
## CSS definitions
<%def name="css()">
<link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
<![endif]-->
## EXTRA FOR CSS
${self.css_extra()}
</%def>
## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
<%def name="css_extra()">
</%def>
${self.css()}
## JAVASCRIPT
<%def name="js()">
<script>
// setup Polymer options
window.Polymer = {lazyRegister: true, dom: 'shadow'};
// Load webcomponentsjs polyfill if browser does not support native Web Components
(function() {
'use strict';
var onload = function() {
// For native Imports, manually fire WebComponentsReady so user code
// can use the same code path for native and polyfill'd imports.
if (!window.HTMLImports) {
document.dispatchEvent(
new CustomEvent('WebComponentsReady', {bubbles: true})
);
}
};
var webComponentsSupported = (
'registerElement' in document
&& 'import' in document.createElement('link')
&& 'content' in document.createElement('template')
);
if (!webComponentsSupported) {
} else {
onload();
}
})();
</script>
<script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
<script type="text/javascript">
// register templateContext to pass template variables to JS
var templateContext = ${h.json.dumps(c.template_context)|n};
var REPO_NAME = "${getattr(c, 'repo_name', '')}";
%if hasattr(c, 'rhodecode_db_repo'):
var REPO_LANDING_REV = '${c.rhodecode_db_repo.landing_rev[1]}';
var REPO_TYPE = '${c.rhodecode_db_repo.repo_type}';
%else:
var REPO_LANDING_REV = '';
var REPO_TYPE = '';
%endif
var APPLICATION_URL = "${h.url('home').rstrip('/')}";
var ASSET_URL = "${h.asset('')}";
var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
% if getattr(c, 'rhodecode_user', None):
var USER = {name:'${c.rhodecode_user.username}'};
% else:
var USER = {name:null};
% endif
var APPENLIGHT = {
enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
key: '${getattr(c, "appenlight_api_public_key", "")}',
% if getattr(c, 'appenlight_server_url', None):
serverUrl: '${getattr(c, "appenlight_server_url", "")}',
% endif
requestInfo: {
% if getattr(c, 'rhodecode_user', None):
ip: '${c.rhodecode_user.ip_addr}',
username: '${c.rhodecode_user.username}'
% endif
},
tags: {
rhodecode_version: '${c.rhodecode_version}',
rhodecode_edition: '${c.rhodecode_edition}'
}
};
</script>
<%include file="/base/plugins_base.html"/>
<!--[if lt IE 9]>
<script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
<![endif]-->
<script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
<script> var alertMessagePayloads = ${h.flash.json_alerts()|n}; </script>
## avoide escaping the %N
<script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}"></script>
<script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
${self.js_extra()}
<script type="text/javascript">
$(document).ready(function(){
show_more_event();
timeagoActivate();
})
</script>
</%def>
## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
<%def name="js_extra()"></%def>
${self.js()}
<%def name="head_extra()"></%def>
${self.head_extra()}
## extra stuff
%if c.pre_code:
${c.pre_code|n}
%endif
</head>
<body id="body">
<noscript>
<div class="noscript-error">
${_('Please enable JavaScript to use RhodeCode Enterprise')}
</div>
</noscript>
## IE hacks
<!--[if IE 7]>
<script>$(document.body).addClass('ie7')</script>
<![endif]-->
<!--[if IE 8]>
<script>$(document.body).addClass('ie8')</script>
<![endif]-->
<!--[if IE 9]>
<script>$(document.body).addClass('ie9')</script>
<![endif]-->
${next.body()}
%if c.post_code:
${c.post_code|n}
%endif
<rhodecode-app></rhodecode-app>
</body>
</html>