Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
76beae70
Commit
76beae70
authored
May 27, 2021
by
Markus Scheidgen
Browse files
Fixed oasis upload auth issue.
parent
809a153b
Pipeline
#102353
passed with stages
in 25 minutes and 43 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/app/flask/api/upload.py
View file @
76beae70
...
...
@@ -267,7 +267,7 @@ class UploadListResource(Resource):
user
=
g
.
user
from_oasis
=
oasis_upload_id
is
not
None
if
from_oasis
:
if
not
g
.
user
.
is_oasis_admin
:
if
not
g
.
user
.
full_user
().
is_oasis_admin
:
abort
(
401
,
'Only an oasis admin can perform an oasis upload.'
)
if
oasis_uploader_id
is
None
:
abort
(
400
,
'You must provide the original uploader for an oasis upload.'
)
...
...
@@ -281,7 +281,7 @@ class UploadListResource(Resource):
uploader_id
=
request
.
args
.
get
(
'uploader_id'
)
if
uploader_id
is
not
None
:
if
not
g
.
user
.
is_admin
:
if
not
g
.
user
.
full_user
().
is_admin
:
abort
(
401
,
'Only an admins can upload for other users.'
)
user
=
datamodel
.
User
.
get
(
user_id
=
uploader_id
)
...
...
nomad/datamodel/datamodel.py
View file @
76beae70
...
...
@@ -117,6 +117,12 @@ class User(Author):
from
nomad
import
infrastructure
return
infrastructure
.
keycloak
.
get_user
(
*
args
,
**
kwargs
)
# type: ignore
def
full_user
(
self
)
->
'User'
:
''' Returns a User object with all attributes loaded from the user management system. '''
from
nomad
import
infrastructure
assert
self
.
user_id
is
not
None
return
infrastructure
.
keycloak
.
get_user
(
user_id
=
self
.
user_id
)
# type: ignore
class
UserReference
(
metainfo
.
Reference
):
'''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment