Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
cdb70106
Commit
cdb70106
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Práva: Místa
parent
ad305183
No related branches found
No related tags found
1 merge request
!19
Reforma vyhodnocování práv
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/web/org_place.py
+8
-16
8 additions, 16 deletions
mo/web/org_place.py
with
8 additions
and
16 deletions
mo/web/org_place.py
+
8
−
16
View file @
cdb70106
...
@@ -29,13 +29,10 @@ def org_place(id: int):
...
@@ -29,13 +29,10 @@ def org_place(id: int):
school
=
None
school
=
None
children
=
sorted
(
place
.
children
,
key
=
lambda
p
:
locale
.
strxfrm
(
p
.
name
))
children
=
sorted
(
place
.
children
,
key
=
lambda
p
:
locale
.
strxfrm
(
p
.
name
))
rr
=
g
.
gatekeeper
.
rights_for
(
place
)
rr
=
mo
.
rights
.
Rights
(
g
.
user
)
rr
.
get_for
(
place
)
return
render_template
(
return
render_template
(
'
org_place.html
'
,
place
=
place
,
school
=
school
,
'
org_place.html
'
,
place
=
place
,
school
=
school
,
rights
=
sorted
(
rr
.
current_rights
,
key
=
lambda
r
:
r
.
name
),
can_edit
=
rr
.
can_edit_place
(
place
),
can_edit
=
rr
.
can_edit_place
(
place
),
children
=
children
children
=
children
)
)
...
@@ -79,9 +76,7 @@ def org_place_edit(id: int):
...
@@ -79,9 +76,7 @@ def org_place_edit(id: int):
if
not
place
:
if
not
place
:
raise
werkzeug
.
exceptions
.
NotFound
()
raise
werkzeug
.
exceptions
.
NotFound
()
rr
=
mo
.
rights
.
Rights
(
g
.
user
)
rr
=
g
.
gatekeeper
.
rights_for
(
place
)
rr
.
get_for
(
place
)
if
not
rr
.
can_edit_place
(
place
):
if
not
rr
.
can_edit_place
(
place
):
raise
werkzeug
.
exceptions
.
Forbidden
()
raise
werkzeug
.
exceptions
.
Forbidden
()
...
@@ -177,8 +172,7 @@ def org_place_move(id: int):
...
@@ -177,8 +172,7 @@ def org_place_move(id: int):
place
=
sess
.
query
(
db
.
Place
).
get
(
id
)
place
=
sess
.
query
(
db
.
Place
).
get
(
id
)
if
not
place
:
if
not
place
:
raise
werkzeug
.
exceptions
.
NotFound
()
raise
werkzeug
.
exceptions
.
NotFound
()
rr
=
mo
.
rights
.
Rights
(
g
.
user
)
rr
=
g
.
gatekeeper
.
rights_for
(
place
)
rr
.
get_for
(
place
)
if
not
rr
.
can_edit_place
(
place
):
if
not
rr
.
can_edit_place
(
place
):
raise
werkzeug
.
exceptions
.
Forbidden
()
raise
werkzeug
.
exceptions
.
Forbidden
()
...
@@ -240,8 +234,7 @@ def org_place_delete(id: int):
...
@@ -240,8 +234,7 @@ def org_place_delete(id: int):
place
=
sess
.
query
(
db
.
Place
).
get
(
id
)
place
=
sess
.
query
(
db
.
Place
).
get
(
id
)
if
not
place
:
if
not
place
:
raise
werkzeug
.
exceptions
.
NotFound
()
raise
werkzeug
.
exceptions
.
NotFound
()
rr
=
mo
.
rights
.
Rights
(
g
.
user
)
rr
=
g
.
gatekeeper
.
rights_for
(
place
)
rr
.
get_for
(
place
)
if
not
rr
.
can_edit_place
(
place
):
if
not
rr
.
can_edit_place
(
place
):
raise
werkzeug
.
exceptions
.
Forbidden
()
raise
werkzeug
.
exceptions
.
Forbidden
()
...
@@ -288,8 +281,7 @@ def org_place_new_child(id: int):
...
@@ -288,8 +281,7 @@ def org_place_new_child(id: int):
parent_place
=
sess
.
query
(
db
.
Place
).
get
(
id
)
parent_place
=
sess
.
query
(
db
.
Place
).
get
(
id
)
if
not
parent_place
:
if
not
parent_place
:
raise
werkzeug
.
exceptions
.
NotFound
()
raise
werkzeug
.
exceptions
.
NotFound
()
rr
=
mo
.
rights
.
Rights
(
g
.
user
)
rr
=
g
.
gatekeeper
.
rights_for
(
parent_place
)
rr
.
get_for
(
parent_place
)
if
not
rr
.
can_edit_place
(
parent_place
):
if
not
rr
.
can_edit_place
(
parent_place
):
raise
werkzeug
.
exceptions
.
Forbidden
()
raise
werkzeug
.
exceptions
.
Forbidden
()
if
not
parent_place
.
can_have_child
():
if
not
parent_place
.
can_have_child
():
...
@@ -360,10 +352,10 @@ def org_place_rights(id: int):
...
@@ -360,10 +352,10 @@ def org_place_rights(id: int):
.
all
())
.
all
())
roles
.
sort
(
key
=
lambda
r
:
(
mo
.
rights
.
role_order_by_type
[
r
.
role
],
r
.
user
.
sort_key
()))
roles
.
sort
(
key
=
lambda
r
:
(
mo
.
rights
.
role_order_by_type
[
r
.
role
],
r
.
user
.
sort_key
()))
rr
=
mo
.
rights
.
Rights
(
g
.
user
)
rr
=
g
.
gatekeeper
.
rights_for
(
place
)
r
r
.
get_for
(
plac
e
)
r
ights
=
sorted
(
rr
.
rights
,
key
=
lambda
r
:
r
.
nam
e
)
return
render_template
(
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
roles
=
roles
,
roles_by_type
=
mo
.
rights
.
roles_by_type
)
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment