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

Práva: Místa

parent f67c3e9d
No related branches found
No related tags found
1 merge request!17Výsledkovka pomocí mo.web.table
This commit is part of merge request !19. Comments created here will be created in the context of that merge request.
......@@ -29,13 +29,10 @@ def org_place(id: int):
school = None
children = sorted(place.children, key=lambda p: locale.strxfrm(p.name))
rr = mo.rights.Rights(g.user)
rr.get_for(place)
rr = g.gatekeeper.rights_for(place)
return render_template(
'org_place.html', place=place, school=school,
rights=sorted(rr.current_rights, key=lambda r: r. name),
can_edit=rr.can_edit_place(place),
children=children
)
......@@ -79,9 +76,7 @@ def org_place_edit(id: int):
if not place:
raise werkzeug.exceptions.NotFound()
rr = mo.rights.Rights(g.user)
rr.get_for(place)
rr = g.gatekeeper.rights_for(place)
if not rr.can_edit_place(place):
raise werkzeug.exceptions.Forbidden()
......@@ -177,8 +172,7 @@ def org_place_move(id: int):
place = sess.query(db.Place).get(id)
if not place:
raise werkzeug.exceptions.NotFound()
rr = mo.rights.Rights(g.user)
rr.get_for(place)
rr = g.gatekeeper.rights_for(place)
if not rr.can_edit_place(place):
raise werkzeug.exceptions.Forbidden()
......@@ -240,8 +234,7 @@ def org_place_delete(id: int):
place = sess.query(db.Place).get(id)
if not place:
raise werkzeug.exceptions.NotFound()
rr = mo.rights.Rights(g.user)
rr.get_for(place)
rr = g.gatekeeper.rights_for(place)
if not rr.can_edit_place(place):
raise werkzeug.exceptions.Forbidden()
......@@ -288,8 +281,7 @@ def org_place_new_child(id: int):
parent_place = sess.query(db.Place).get(id)
if not parent_place:
raise werkzeug.exceptions.NotFound()
rr = mo.rights.Rights(g.user)
rr.get_for(parent_place)
rr = g.gatekeeper.rights_for(parent_place)
if not rr.can_edit_place(parent_place):
raise werkzeug.exceptions.Forbidden()
if not parent_place.can_have_child():
......@@ -360,10 +352,10 @@ def org_place_rights(id: int):
.all())
roles.sort(key=lambda r: (mo.rights.role_order_by_type[r.role], r.user.sort_key()))
rr = mo.rights.Rights(g.user)
rr.get_for(place)
rr = g.gatekeeper.rights_for(place)
rights = sorted(rr.rights, key=lambda r: r.name)
return render_template(
'org_place_rights.html', place=place, rights=rr.current_rights,
'org_place_rights.html', place=place, rights=rights,
roles=roles, roles_by_type=mo.rights.roles_by_type
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment