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
MO-P
Odevzdávací Systém MO
Commits
3e33c807
Commit
3e33c807
authored
Jan 16, 2021
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Práva: Import
parent
b7940fa0
Branches
Branches containing commit
No related tags found
1 merge request
!19
Reforma vyhodnocování práv
This commit is part of merge request
!19
. Comments created here will be created in the context of that merge request.
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mo/imports.py
+4
-14
4 additions, 14 deletions
mo/imports.py
with
4 additions
and
14 deletions
mo/imports.py
+
4
−
14
Edit
View file @
3e33c807
...
...
@@ -54,8 +54,7 @@ class Import:
# Interní: Stav importu
place_cache
:
Dict
[
str
,
db
.
Place
]
school_place_cache
:
Dict
[
str
,
db
.
Place
]
rr
:
Optional
[
mo
.
rights
.
Rights
]
place_rights_cache
:
Dict
[
int
,
bool
]
gatekeeper
:
mo
.
rights
.
Gatekeeper
new_user_ids
:
List
[
int
]
line_number
:
int
=
0
...
...
@@ -64,7 +63,6 @@ class Import:
self
.
rr
=
None
self
.
place_cache
=
{}
self
.
school_place_cache
=
{}
self
.
place_rights_cache
=
{}
self
.
new_user_ids
=
[]
def
setup
(
self
):
...
...
@@ -103,19 +101,10 @@ class Import:
return
name
def
check_rights
(
self
,
place
:
db
.
Place
)
->
bool
:
if
place
.
place_id
in
self
.
place_rights_cache
:
return
self
.
place_rights_cache
[
place
.
place_id
]
if
self
.
rr
is
None
:
self
.
rr
=
mo
.
rights
.
Rights
(
self
.
user
)
round
=
self
.
round
assert
round
is
not
None
self
.
rr
.
get_for
(
place
,
round
.
year
,
round
.
category
,
round
.
seq
)
result
=
self
.
rr
.
have_right
(
mo
.
rights
.
Right
.
manage_contest
)
self
.
place_rights_cache
[
place
.
place_id
]
=
result
return
result
rights
=
self
.
gatekeeper
.
rights_for
(
place
,
round
.
year
,
round
.
category
,
round
.
seq
)
return
rights
.
have_right
(
mo
.
rights
.
Right
.
manage_contest
)
def
parse_opt_place
(
self
,
kod
:
str
)
->
Optional
[
db
.
Place
]:
if
kod
==
""
:
...
...
@@ -564,6 +553,7 @@ def create_import(user: db.User, type: ImportType, fmt: FileFormat, round: Optio
imp
.
round
=
round
imp
.
contest
=
contest
imp
.
fmt
=
fmt
imp
.
gatekeeper
=
mo
.
rights
.
Gatekeeper
(
user
)
imp
.
setup
()
return
imp
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
sign in
to comment