Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jupyter-jsc-custom
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jupyterjsc
packages
jupyter-jsc-custom
Commits
1c0c4c9f
Commit
1c0c4c9f
authored
1 month ago
by
Tim Kreuzer
Browse files
Options
Downloads
Patches
Plain Diff
fix user usage
parent
0989abb5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
jsc_custom/apihandler/frontend.py
+27
-26
27 additions, 26 deletions
jsc_custom/apihandler/frontend.py
with
27 additions
and
26 deletions
jsc_custom/apihandler/frontend.py
+
27
−
26
View file @
1c0c4c9f
...
@@ -12,7 +12,7 @@ from .misc import NoXSRFCheckAPIHandler
...
@@ -12,7 +12,7 @@ from .misc import NoXSRFCheckAPIHandler
class
FHostnameAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FHostnameAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
write
(
jhub_hostname
)
self
.
write
(
jhub_hostname
)
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -20,7 +20,7 @@ class FHostnameAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -20,7 +20,7 @@ class FHostnameAPIHandler(NoXSRFCheckAPIHandler):
class
FSystemConfigAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FSystemConfigAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
systems
"
,
{})))
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
systems
"
,
{})))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -28,9 +28,9 @@ class FSystemConfigAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -28,9 +28,9 @@ class FSystemConfigAPIHandler(NoXSRFCheckAPIHandler):
class
FMapSystemsAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FMapSystemsAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
mapSystems
"
,
{})))
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
mapSystems
"
,
{})))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -38,9 +38,9 @@ class FMapSystemsAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -38,9 +38,9 @@ class FMapSystemsAPIHandler(NoXSRFCheckAPIHandler):
class
FMapPartitionsAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FMapPartitionsAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
mapPartitions
"
,
{})))
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
mapPartitions
"
,
{})))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -48,9 +48,9 @@ class FMapPartitionsAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -48,9 +48,9 @@ class FMapPartitionsAPIHandler(NoXSRFCheckAPIHandler):
class
FDefaultPartitionsAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FDefaultPartitionsAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
defaultPartitions
"
,
{})))
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
defaultPartitions
"
,
{})))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -58,9 +58,9 @@ class FDefaultPartitionsAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -58,9 +58,9 @@ class FDefaultPartitionsAPIHandler(NoXSRFCheckAPIHandler):
class
FServicesAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FServicesAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
services
"
,
{})))
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
services
"
,
{})))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -68,9 +68,9 @@ class FServicesAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -68,9 +68,9 @@ class FServicesAPIHandler(NoXSRFCheckAPIHandler):
class
FResourcesAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FResourcesAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
resources
"
,
{})))
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
resources
"
,
{})))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -78,9 +78,9 @@ class FResourcesAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -78,9 +78,9 @@ class FResourcesAPIHandler(NoXSRFCheckAPIHandler):
class
FUserModulesAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FUserModulesAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
userModules
"
,
{})))
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
userModules
"
,
{})))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -88,9 +88,9 @@ class FUserModulesAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -88,9 +88,9 @@ class FUserModulesAPIHandler(NoXSRFCheckAPIHandler):
class
FBackendServicesAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FBackendServicesAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
backendServices
"
,
{})))
self
.
write
(
json
.
dumps
(
get_custom_config
().
get
(
"
backendServices
"
,
{})))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -98,18 +98,18 @@ class FBackendServicesAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -98,18 +98,18 @@ class FBackendServicesAPIHandler(NoXSRFCheckAPIHandler):
class
FIncidentCheckAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FIncidentCheckAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
self
.
write
(
json
.
dumps
(
get_incidents
(
user
)))
self
.
write
(
json
.
dumps
(
get_incidents
(
user
)))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
return
return
class
FReservationsAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FReservationsAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
self
.
write
(
json
.
dumps
(
get_reservations
()))
self
.
write
(
json
.
dumps
(
get_reservations
()))
self
.
set_status
(
200
)
self
.
set_status
(
200
)
...
@@ -117,9 +117,9 @@ class FReservationsAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -117,9 +117,9 @@ class FReservationsAPIHandler(NoXSRFCheckAPIHandler):
class
FUserOptionsAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FUserOptionsAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
g
et_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
s
et_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
not
None
:
if
user
is
not
None
:
user_options
=
await
async_decrypted_user_options
(
user
)
user_options
=
await
async_decrypted_user_options
(
user
)
self
.
write
(
json
.
dumps
(
user_options
))
self
.
write
(
json
.
dumps
(
user_options
))
...
@@ -128,9 +128,9 @@ class FUserOptionsAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -128,9 +128,9 @@ class FUserOptionsAPIHandler(NoXSRFCheckAPIHandler):
class
FUserAPIHandler
(
NoXSRFCheckAPIHandler
):
class
FUserAPIHandler
(
NoXSRFCheckAPIHandler
):
async
def
get
(
self
,
user_name
=
""
):
async
def
get
(
self
):
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
self
.
set_header
(
"
Cache-Control
"
,
"
no-cache
"
)
user
=
self
.
find_user
(
user_name
)
user
=
self
.
current_user
if
user
is
None
:
if
user
is
None
:
raise
web
.
HTTPError
(
404
)
raise
web
.
HTTPError
(
404
)
...
@@ -151,7 +151,7 @@ class FUserAPIHandler(NoXSRFCheckAPIHandler):
...
@@ -151,7 +151,7 @@ class FUserAPIHandler(NoXSRFCheckAPIHandler):
return
return
default_handlers
.
append
((
r
"
/api/f/
incidents
"
,
FHostnameAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/
hostname
"
,
FHostnameAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/systemconfig
"
,
FSystemConfigAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/systemconfig
"
,
FSystemConfigAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/mapsystems
"
,
FMapSystemsAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/mapsystems
"
,
FMapSystemsAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/mappartitions
"
,
FMapPartitionsAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/mappartitions
"
,
FMapPartitionsAPIHandler
))
...
@@ -163,4 +163,5 @@ default_handlers.append((r"/api/f/backendservices", FBackendServicesAPIHandler))
...
@@ -163,4 +163,5 @@ default_handlers.append((r"/api/f/backendservices", FBackendServicesAPIHandler))
default_handlers
.
append
((
r
"
/api/f/incidents
"
,
FIncidentCheckAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/incidents
"
,
FIncidentCheckAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/reservations
"
,
FReservationsAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/reservations
"
,
FReservationsAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/useroptions
"
,
FUserOptionsAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/useroptions
"
,
FUserOptionsAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/users
"
,
FUserAPIHandler
))
default_handlers
.
append
((
r
"
/api/f/users
"
,
FUserAPIHandler
))
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