Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
protokollsystem
proto3
Commits
1a842c34
Commit
1a842c34
authored
Mar 05, 2017
by
Administrator
Browse files
Better message if no protocols are visible because of the network address
parent
50b19a9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
models/database.py
View file @
1a842c34
...
...
@@ -22,7 +22,6 @@ class DatabaseModel(db.Model):
__abstract__
=
True
def
has_public_view_right
(
self
,
user
):
print
(
"DBModel"
)
return
self
.
get_parent
().
has_public_view_right
(
user
)
def
has_private_view_right
(
self
,
user
):
...
...
@@ -105,14 +104,14 @@ class ProtocolType(DatabaseModel):
return
None
return
candidates
[
0
]
def
has_public_view_right
(
self
,
user
):
return
(
self
.
has_public_anonymous_view_right
()
def
has_public_view_right
(
self
,
user
,
check_networks
=
True
):
return
(
self
.
has_public_anonymous_view_right
(
check_networks
=
check_networks
)
or
(
user
is
not
None
and
self
.
has_public_authenticated_view_right
(
user
))
or
self
.
has_admin_right
(
user
))
def
has_public_anonymous_view_right
(
self
):
def
has_public_anonymous_view_right
(
self
,
check_networks
=
True
):
return
(
self
.
is_public
and
(
not
self
.
restrict_networks
and
(
(
not
self
.
restrict_networks
or
not
check_networks
)
or
check_ip_in_networks
(
self
.
allowed_networks
)))
def
has_public_authenticated_view_right
(
self
,
user
):
...
...
server.py
View file @
1a842c34
...
...
@@ -136,14 +136,15 @@ def index():
user
=
current_user
()
protocols
=
[
protocol
for
protocol
in
Protocol
.
query
.
all
()
if
protocol
.
protocoltype
.
has_public_view_right
(
user
)
if
protocol
.
protocoltype
.
has_public_view_right
(
user
,
check_networks
=
False
)
]
def
_protocol_sort_key
(
protocol
):
if
protocol
.
date
is
not
None
:
return
protocol
.
date
return
datetime
.
now
().
date
()
current_day
=
datetime
.
now
().
date
()
open_protocols
=
sorted
(
all_
open_protocols
=
sorted
(
[
protocol
for
protocol
in
protocols
if
not
protocol
.
done
...
...
@@ -151,12 +152,17 @@ def index():
],
key
=
_protocol_sort_key
)
open_protocols
=
[
protocol
for
protocol
in
all_open_protocols
if
protocol
.
protocoltype
.
has_public_view_right
(
user
)
]
finished_protocols
=
sorted
(
[
protocol
for
protocol
in
protocols
if
protocol
.
done
and
(
protocol
.
has_public_view_right
(
user
)
or
protocol
.
has_private_view_right
(
user
))
and
protocol
.
protocoltype
.
has_public_view_right
(
user
)
],
key
=
_protocol_sort_key
,
reverse
=
True
...
...
@@ -174,7 +180,7 @@ def index():
return
protocol
.
date
if
protocol
.
date
is
not
None
else
datetime
.
now
().
date
()
todos
=
sorted
(
todos
,
key
=
_todo_sort_key
,
reverse
=
True
)
todos_table
=
TodosTable
(
todos
)
if
todos
is
not
None
else
None
return
render_template
(
"index.html"
,
open_protocols
=
open_protocols
,
protocol
=
protocol
,
todos
=
todos
,
todos_table
=
todos_table
)
return
render_template
(
"index.html"
,
open_protocols
=
open_protocols
,
protocol
=
protocol
,
todos
=
todos
,
todos_table
=
todos_table
,
all_open_protocols
=
all_open_protocols
)
@
app
.
route
(
"/documentation"
)
@
login_required
...
...
templates/index.html
View file @
1a842c34
...
...
@@ -18,7 +18,11 @@
<li><a
href=
"{{url_for("
show_protocol
",
protocol_id=
protocol.id)}}"
>
{{protocol.protocoltype.name}}
</a>
am {{protocol.date|datify}}
</li>
{% endfor %}
{% else %}
<li>
Keine anstehenden Sitzungen
</li>
{% if all_open_protocols|length == 0 %}
<li>
Keine anstehenden Sitzungen
</li>
{% else %}
<li>
Die Sitzungen sind nur aus einem eingeschränkten Teil des Internets, nicht weltweit sichtbar.
</li>
{% endif %}
{% endif %}
</ul>
{% if check_login() %}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment