-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth tidy #613
Auth tidy #613
Conversation
* Blacken code. * Put permissions in order. * Add comments. * Use Google-style docstrings.
* Rationalise the configuration object type earlier. * This avoids managing multiple data types throughout the code.
* Replace the `owner_user_info` dictionary (which contained two keys, one of which was duplicated) into variables. * This removes unnecessary dictionary lookups, the potential for key errors and makes typing easier.
* Also add tests covering the snake/camel case calling of the is_permitted interface.
self.config.CylcUIServer.user_authorization, | ||
self.config.CylcUIServer.site_authorization, | ||
self.log | ||
self.config.CylcUIServer.user_authorization.to_dict(), | ||
self.config.CylcUIServer.site_authorization.to_dict(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just pulled and now getting an error when accessing cylc hub
[W 2024-07-12 14:51:13.403 CylcHubApp manager:363] cylc.uiserver | extension failed loading with message: AttributeError("'dict' object has no attribute 'to_dict'")
Traceback (most recent call last):
File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 359, in load_extension
extension.load_all_points(self.serverapp)
File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 231, in load_all_points
return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 231, in <listcomp>
return [self.load_point(point_name, serverapp) for point_name in self.extension_points]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 222, in load_point
return point.load(serverapp)
^^^^^^^^^^^^^^^^^^^^^
File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/manager.py", line 150, in load
return loader(serverapp)
^^^^^^^^^^^^^^^^^
File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 474, in _load_jupyter_server_extension
extension.initialize()
File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 436, in initialize
self._prepare_handlers()
File "~/.conda/envs/cylc8/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 326, in _prepare_handlers
self.initialize_handlers()
File "~/github/cylc-uiserver/cylc/uiserver/app.py", line 464, in initialize_handlers
self.authobj = self.set_auth()
^^^^^^^^^^^^^^^
File "~/github/cylc-uiserver/cylc/uiserver/app.py", line 552, in set_auth
self.config.CylcUIServer.site_authorization.to_dict(),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'to_dict'
In our site config, c.CylcUIServer.site_authorization
is a dict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't see a case where this would be a dict, no I know.
I have no idea why using the hub would cause the configuration object to differ, but an easy fix.
(low priority)
Looking into the feasibility of making a change to the auth code.
Before changing anything around, I wanted to get the coverage up.
Overview:
Full details in the individual commit messages (easier to review changes one by one).
As always with auth code changes (even ones like this which shouldn't change any functionality), please extensively test this (note you can use exvcylc17 for this)!
Plz squash merge.
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).CHANGES.md
entry included if this is a change that can affect users?.?.x
branch.