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

r1:854a839a default
r887:175782be default
Show More
settings_hooks.html
93 lines | 3.2 KiB | text/html | HtmlLexer
project: added all source files and assets
r1 <div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_('Built in Mercurial hooks - read only')}</h3>
</div>
<div class="panel-body">
<div class="form">
<div class="fields">
% for hook in c.hooks:
<div class="field">
<div class="label label">
<label for="${hook.ui_key}">${hook.ui_key}</label>
</div>
<div class="input" >
${h.text(hook.ui_key,hook.ui_value,size=59,readonly="readonly")}
</div>
</div>
% endfor
</div>
<span class="help-block">${_('Hooks can be used to trigger actions on certain events such as push / pull. They can trigger Python functions or external applications.')}</span>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">${_('Custom hooks')}</h3>
</div>
<div class="panel-body">
% if c.visual.allow_custom_hooks_settings:
${h.secure_form(url('admin_settings_hooks'), method='post')}
<div class="form">
<div class="fields">
% for hook in c.custom_hooks:
<div class="field" id="${'id%s' % hook.ui_id }">
<div class="label label">
<label for="${hook.ui_key}">${hook.ui_key}</label>
</div>
<div class="input" >
${h.hidden('hook_ui_key',hook.ui_key)}
${h.hidden('hook_ui_value',hook.ui_value)}
${h.text('hook_ui_value_new',hook.ui_value,size=59)}
<span class="btn btn-danger"
onclick="ajaxActionHook(${hook.ui_id},'${'id%s' % hook.ui_id }')">
${_('Delete')}
</span>
</div>
</div>
% endfor
<div class="field customhooks">
<div class="label">
<div class="input-wrapper">
${h.text('new_hook_ui_key',size=30)}
</div>
</div>
<div class="input">
${h.text('new_hook_ui_value',size=59)}
</div>
</div>
<div class="buttons">
${h.submit('save',_('Save'),class_="btn")}
</div>
</div>
</div>
${h.end_form()}
%else:
DISABLED
% endif
</div>
</div>
<script type="text/javascript">
function ajaxActionHook(hook_id,field_id) {
var sUrl = "${h.url('admin_settings_hooks')}";
var callback = function (o) {
var elem = $("#"+field_id);
elem.remove();
};
var postData = {
'_method': 'delete',
'hook_id': hook_id,
'csrf_token': CSRF_TOKEN
};
var request = $.post(sUrl, postData)
.done(callback)
.fail(function (data, textStatus, errorThrown) {
alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
});
};
</script>