Files @ a17c8e5f6712
Branch filter:

Location: kallithea/kallithea/templates/search/search_commit.html

Søren Løvborg
auth: simplify repository permission checks

In practice, Kallithea has the 'repository.admin' permission imply the
'repository.write' permission, which again implies 'repository.read'.

This codifies/enforces this practice by replacing HasRepoPermissionAny
"perm function" with the new HasRepositoryLevel function, reducing the
risk of errors and saving quite a lot of typing.
##commit highlighting

%for cnt,sr in enumerate(c.formated_results):
    %if h.HasRepoPermissionLevel('read')(sr['repository'],'search results check'):
        <div id="body${cnt}" class="codeblock">
            <div class="code-header">
                <div class="search-path">${h.link_to(h.literal('%s &raquo; %s' % (sr['repository'],sr['raw_id'])),
                h.url('changeset_home',repo_name=sr['repository'],revision=sr['raw_id']))}
                ${h.fmt_date(h.time_to_datetime(sr['date']))}
                </div>
            </div>
            <div class="left">
                <div class="author">
                    ${h.gravatar_div(h.email_or_none(sr['author']), size=20)}
                    <span>${h.person(sr['author'])}</span><br/>
                    <span>${h.email_or_none(sr['author'])}</span><br/>
                </div>
                %if sr['message_hl']:
                <div class="search-code-body">
                    <pre>${h.literal(sr['message_hl'])}</pre>
                </div>
                %else:
                <div class="message">${h.urlify_text(sr['message'], sr['repository'])}</div>
                %endif
            </div>
        </div>
    %else:
        %if cnt == 0:
            <div id="body${cnt}" class="codeblock">
                <div class="error">${_('Permission denied')}</div>
            </div>
        %endif
    %endif
%endfor
%if c.cur_query and c.formated_results:
    <ul class="pagination">
        ${c.formated_results.pager()}
    </ul>
%endif