Skip to content

Commit b3a7b74

Browse files
author
Richard Jones
committed
nicer "permission required" messages (patch [SF#1558183])
1 parent 0fe6236 commit b3a7b74

File tree

13 files changed

+81
-19
lines changed

13 files changed

+81
-19
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Fixed:
1515
- fix error detection for non-EN locales of postgres (sf bug 1592249)
1616
- fix email change note rendering of multiline properties (sf patch 1575223)
1717
- fix sidebar search links (sf patch 1574467)
18+
- nicer "permission required" messages (sf patch 1558183)
1819

1920

2021
2006-10-07 1.2.1

templates/classic/html/_generic.index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111

1212
<td class="content" metal:fill-slot="content">
1313

14-
<span tal:condition="python:not (context.is_view_ok() or context.is_edit_ok())"
14+
<span tal:condition="python:not (context.is_view_ok() or context.is_edit_ok()
15+
or request.user.hasRole('Anonymous'))"
1516
tal:omit-tag="python:1" i18n:translate=""
1617
>You are not allowed to view this page.</span>
1718

19+
<span tal:condition="python:not (context.is_view_ok() or context.is_edit_ok())
20+
and request.user.hasRole('Anonymous')"
21+
tal:omit-tag="python:1" i18n:translate=""
22+
>Please login with your username and password.</span>
23+
1824
<tal:block tal:condition="context/is_edit_ok">
1925
<tal:block i18n:translate="">
2026
<p class="form-help">

templates/classic/html/_generic.item.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99

1010
<td class="content" metal:fill-slot="content">
1111

12-
<p tal:condition="not:context/is_view_ok" i18n:translate="">You are not
13-
allowed to view this page.</p>
12+
<p tal:condition="python:not (context.is_view_ok()
13+
or request.user.hasRole('Anonymous'))" i18n:translate="">
14+
You are not allowed to view this page.</p>
15+
16+
<p tal:condition="python:not context.is_view_ok()
17+
and request.user.hasRole('Anonymous')" i18n:translate="">
18+
Please login with your username and password.</p>
1419

1520
<div tal:condition="context/is_view_ok">
1621

templates/classic/html/file.item.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66

77
<td class="content" metal:fill-slot="content">
88

9-
<p tal:condition="not:context/is_view_ok" i18n:translate="">You are not
10-
allowed to view this page.</p>
9+
<p tal:condition="python:not (context.is_view_ok()
10+
or request.user.hasRole('Anonymous'))" i18n:translate="">
11+
You are not allowed to view this page.</p>
12+
13+
<p tal:condition="python:not context.is_view_ok()
14+
and request.user.hasRole('Anonymous')" i18n:translate="">
15+
Please login with your username and password.</p>
1116

1217
<form method="POST" onSubmit="return submit_once()"
1318
enctype="multipart/form-data" tal:condition="context/is_view_ok"

templates/classic/html/issue.index.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Id: issue.index.html,v 1.26 2006-11-09 00:46:54 richard Exp $ -->
1+
<!-- $Id: issue.index.html,v 1.27 2006-11-09 01:26:28 richard Exp $ -->
22
<tal:block metal:use-macro="templates/page/macros/icing">
33
<title metal:fill-slot="head_title" >
44
<span tal:omit-tag="true" i18n:translate="" >List of issues</span>
@@ -13,8 +13,13 @@
1313
</span>
1414
<td class="content" metal:fill-slot="content">
1515

16-
<p tal:condition="not:context/is_view_ok" i18n:translate="">You are not
17-
allowed to view this page.</p>
16+
<p tal:condition="python:not (context.is_view_ok()
17+
or request.user.hasRole('Anonymous'))" i18n:translate="">
18+
You are not allowed to view this page.</p>
19+
20+
<p tal:condition="python:not context.is_view_ok()
21+
and request.user.hasRole('Anonymous')" i18n:translate="">
22+
Please login with your username and password.</p>
1823

1924
<tal:block tal:define="batch request/batch" tal:condition="context/is_view_ok">
2025
<table class="list">

templates/classic/html/issue.item.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@
2525

2626
<td class="content" metal:fill-slot="content">
2727

28-
<p tal:condition="not:context/is_view_ok" i18n:translate="">You are not
29-
allowed to view this page.</p>
28+
<p tal:condition="python:not (context.is_view_ok()
29+
or request.user.hasRole('Anonymous'))" i18n:translate="">
30+
You are not allowed to view this page.</p>
31+
32+
<p tal:condition="python:not context.is_view_ok()
33+
and request.user.hasRole('Anonymous')" i18n:translate="">
34+
Please login with your username and password.</p>
3035

3136
<div tal:condition="context/is_view_ok">
3237

templates/classic/html/msg.item.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@
2323
</tal:block>
2424
<td class="content" metal:fill-slot="content">
2525

26-
<p tal:condition="not:context/is_view_ok" i18n:translate="">You are not
27-
allowed to view this page.</p>
26+
<p tal:condition="python:not (context.is_view_ok()
27+
or request.user.hasRole('Anonymous'))" i18n:translate="">
28+
You are not allowed to view this page.</p>
29+
30+
<p tal:condition="python:not context.is_view_ok()
31+
and request.user.hasRole('Anonymous')" i18n:translate="">
32+
Please login with your username and password.</p>
2833

2934
<div tal:condition="context/is_view_ok">
3035
<table class="form">

templates/classic/html/user.index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
i18n:translate="">User listing</span>
77
<td class="content" metal:fill-slot="content">
88

9-
<span tal:condition="not:context/is_view_ok"
9+
<span tal:condition="python:not (context.is_view_ok()
10+
or request.user.hasRole('Anonymous'))"
1011
i18n:translate="">You are not allowed to view this page.</span>
1112

13+
<span tal:condition="python:not context.is_view_ok()
14+
and request.user.hasRole('Anonymous')"
15+
i18n:translate="">Please login with your username and password.</span>
16+
1217
<table width="100%" tal:condition="context/is_view_ok" class="list">
1318
<tr>
1419
<th i18n:translate="">Username</th>

templates/classic/html/user.item.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@
3232

3333
<td class="content" metal:fill-slot="content">
3434

35-
<p tal:condition="not:context/is_view_ok" i18n:translate="">You are not
36-
allowed to view this page.</p>
35+
<p tal:condition="python:not (context.is_view_ok()
36+
or request.user.hasRole('Anonymous'))" i18n:translate="">
37+
You are not allowed to view this page.</p>
38+
39+
<p tal:condition="python:not context.is_view_ok()
40+
and request.user.hasRole('Anonymous')" i18n:translate="">
41+
Please login with your username and password.</p>
3742

3843
<div tal:condition="context/is_view_ok">
3944

templates/minimal/html/_generic.index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111

1212
<td class="content" metal:fill-slot="content">
1313

14-
<span tal:condition="python:not (context.is_view_ok() or context.is_edit_ok())"
14+
<span tal:condition="python:not (context.is_view_ok() or context.is_edit_ok()
15+
or request.user.hasRole('Anonymous'))"
1516
tal:omit-tag="python:1" i18n:translate=""
1617
>You are not allowed to view this page.</span>
1718

19+
<span tal:condition="python:not (context.is_view_ok() or context.is_edit_ok())
20+
and request.user.hasRole('Anonymous')"
21+
tal:omit-tag="python:1" i18n:translate=""
22+
>Please login with your username and password.</span>
23+
1824
<tal:block tal:condition="context/is_edit_ok">
1925
<tal:block i18n:translate="">
2026
<p class="form-help">

0 commit comments

Comments
 (0)