Skip to content
Snippets Groups Projects
Commit 9870e693 authored by Martin Mareš's avatar Martin Mareš
Browse files

Mít právo editovat místo a přidat mu podřízené není totéž

parent 89844ead
No related branches found
No related tags found
1 merge request!17Výsledkovka pomocí mo.web.table
This commit is part of merge request !17. Comments created here will be created in the context of that merge request.
......@@ -153,6 +153,14 @@ class Rights:
return True
return False
def can_add_place_child(self, place: db.Place):
if self.have_right(Right.edit_region):
return True
elif place.level >= 2 and self.have_right(Right.edit_place):
# Can add cities and lower
return True
return False
def can_edit_user(self, user: db.User):
if user.is_admin:
return self.user.is_admin # only admins can edit admins
......
......@@ -34,6 +34,7 @@ def org_place(id: int):
return render_template(
'org_place.html', place=place, school=school,
can_edit=rr.can_edit_place(place),
can_add_child=rr.can_add_place_child(place),
children=children
)
......
......@@ -49,7 +49,7 @@
{% endfor %}
</table>
{% endif %}
{% if can_edit %}
{% if can_add_child %}
<a class="btn btn-primary" href="{{ url_for('org_place_new_child', id=place.place_id) }}">Přidat nové podřízené místo</a>
{% endif %}
{% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment