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
9870e693
Commit
9870e693
authored
4 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
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
!17
Výsledkovka pomocí mo.web.table
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
mo/rights.py
+8
-0
8 additions, 0 deletions
mo/rights.py
mo/web/org_place.py
+1
-0
1 addition, 0 deletions
mo/web/org_place.py
mo/web/templates/org_place.html
+1
-1
1 addition, 1 deletion
mo/web/templates/org_place.html
with
10 additions
and
1 deletion
mo/rights.py
+
8
−
0
View file @
9870e693
...
@@ -153,6 +153,14 @@ class Rights:
...
@@ -153,6 +153,14 @@ class Rights:
return
True
return
True
return
False
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
):
def
can_edit_user
(
self
,
user
:
db
.
User
):
if
user
.
is_admin
:
if
user
.
is_admin
:
return
self
.
user
.
is_admin
# only admins can edit admins
return
self
.
user
.
is_admin
# only admins can edit admins
...
...
This diff is collapsed.
Click to expand it.
mo/web/org_place.py
+
1
−
0
View file @
9870e693
...
@@ -34,6 +34,7 @@ def org_place(id: int):
...
@@ -34,6 +34,7 @@ def org_place(id: int):
return
render_template
(
return
render_template
(
'
org_place.html
'
,
place
=
place
,
school
=
school
,
'
org_place.html
'
,
place
=
place
,
school
=
school
,
can_edit
=
rr
.
can_edit_place
(
place
),
can_edit
=
rr
.
can_edit_place
(
place
),
can_add_child
=
rr
.
can_add_place_child
(
place
),
children
=
children
children
=
children
)
)
...
...
This diff is collapsed.
Click to expand it.
mo/web/templates/org_place.html
+
1
−
1
View file @
9870e693
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
{% endfor %}
{% endfor %}
</table>
</table>
{% endif %}
{% 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>
<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 %}
{% endif %}
{% endif %}
...
...
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