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
Project 'mj/mo-submit' was moved to 'mo-p/osmo'. Please update any links and bookmarks that may still have the old path.
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
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
View file @
3e33c807
...
@@ -54,8 +54,7 @@ class Import:
...
@@ -54,8 +54,7 @@ class Import:
# Interní: Stav importu
# Interní: Stav importu
place_cache
:
Dict
[
str
,
db
.
Place
]
place_cache
:
Dict
[
str
,
db
.
Place
]
school_place_cache
:
Dict
[
str
,
db
.
Place
]
school_place_cache
:
Dict
[
str
,
db
.
Place
]
rr
:
Optional
[
mo
.
rights
.
Rights
]
gatekeeper
:
mo
.
rights
.
Gatekeeper
place_rights_cache
:
Dict
[
int
,
bool
]
new_user_ids
:
List
[
int
]
new_user_ids
:
List
[
int
]
line_number
:
int
=
0
line_number
:
int
=
0
...
@@ -64,7 +63,6 @@ class Import:
...
@@ -64,7 +63,6 @@ class Import:
self
.
rr
=
None
self
.
rr
=
None
self
.
place_cache
=
{}
self
.
place_cache
=
{}
self
.
school_place_cache
=
{}
self
.
school_place_cache
=
{}
self
.
place_rights_cache
=
{}
self
.
new_user_ids
=
[]
self
.
new_user_ids
=
[]
def
setup
(
self
):
def
setup
(
self
):
...
@@ -103,19 +101,10 @@ class Import:
...
@@ -103,19 +101,10 @@ class Import:
return
name
return
name
def
check_rights
(
self
,
place
:
db
.
Place
)
->
bool
:
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
round
=
self
.
round
assert
round
is
not
None
assert
round
is
not
None
self
.
rr
.
get_for
(
place
,
round
.
year
,
round
.
category
,
round
.
seq
)
rights
=
self
.
gatekeeper
.
rights_for
(
place
,
round
.
year
,
round
.
category
,
round
.
seq
)
result
=
self
.
rr
.
have_right
(
mo
.
rights
.
Right
.
manage_contest
)
return
rights
.
have_right
(
mo
.
rights
.
Right
.
manage_contest
)
self
.
place_rights_cache
[
place
.
place_id
]
=
result
return
result
def
parse_opt_place
(
self
,
kod
:
str
)
->
Optional
[
db
.
Place
]:
def
parse_opt_place
(
self
,
kod
:
str
)
->
Optional
[
db
.
Place
]:
if
kod
==
""
:
if
kod
==
""
:
...
@@ -564,6 +553,7 @@ def create_import(user: db.User, type: ImportType, fmt: FileFormat, round: Optio
...
@@ -564,6 +553,7 @@ def create_import(user: db.User, type: ImportType, fmt: FileFormat, round: Optio
imp
.
round
=
round
imp
.
round
=
round
imp
.
contest
=
contest
imp
.
contest
=
contest
imp
.
fmt
=
fmt
imp
.
fmt
=
fmt
imp
.
gatekeeper
=
mo
.
rights
.
Gatekeeper
(
user
)
imp
.
setup
()
imp
.
setup
()
return
imp
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