Skip to content

Commit

Permalink
[Admin] Hide admin index forms without permission.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Nov 5, 2024
1 parent a8d3569 commit 182f35b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions t/cobrand/tfl.t
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ for my $host ( 'www.fixmystreet.com', 'tfl.fixmystreet.com' ) {
subtest 'TfL staff can access TfL admin' => sub {
$mech->log_in_ok( $staffuser->email );
$mech->get_ok('/admin');
$mech->content_contains( 'Search Reports' );
$mech->content_contains( '<h1>Summary</h1>' );
};

subtest 'TLRN categories cannot be renamed' => sub {
Expand Down Expand Up @@ -1439,7 +1439,7 @@ FixMyStreet::override_config {
subtest 'Bromley staff can access Bromley admin' => sub {
$mech->log_in_ok( $bromleyuser->email );
$mech->get_ok('/admin');
$mech->content_contains( 'Search Reports' );
$mech->content_contains( '<h1>Summary</h1>' );
$mech->log_out_ok;
};

Expand Down
4 changes: 4 additions & 0 deletions templates/web/base/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@

<div class="admin-index-search clearfix">

[% IF c.user.has_body_permission_to('report_edit') %]
<form method="get" action="[% c.uri_for('reports') %]" accept-charset="utf-8">
<label for="search_reports">[% loc('Search Reports') %]</label>
<div class="form-txt-submit-box">
<input type="text" class="form-control" name="search" size="30" id="search_reports" value="[% searched | html %]">
<input type="submit" class="btn" value="[% loc('Go') %]">
</div>
</form>
[% END %]

[% IF c.user.has_body_permission_to('user_edit') %]
<form method="get" action="[% c.uri_for('users') %]" accept-charset="utf-8">
<label for="search_users">[% loc('Search Users') %]</label>
<div class="form-txt-submit-box">
<input type="text" class="form-control" name="search" size="30" id="search_users" value="[% searched | html %]">
<input type="submit" class="btn" value="[% loc('Go') %]">
</div>
</form>
[% END %]

[% TRY %][% PROCESS 'admin/_index_extra_search.html' %][% CATCH file %][% END %]

Expand Down

0 comments on commit 182f35b

Please sign in to comment.