Skip to content

Commit

Permalink
Fix/allow editors data dictionary (#2822)
Browse files Browse the repository at this point in the history
* fix: allow editors to edit dictionaries

* fix: add logging to proxy sso
  • Loading branch information
niross authored Oct 23, 2023
1 parent 5f28413 commit 26e57d8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ class DataDictionaryEditView(View):
def dispatch(self, request, *args, **kwargs):
dataset_uuid = self.kwargs.get("dataset_uuid")
dataset = find_dataset(dataset_uuid, self.request.user)
if (
request.user
not in [
dataset.information_asset_owner,
dataset.information_asset_manager,
]
and not request.user.is_superuser
):
valid_users = [
dataset.information_asset_owner,
dataset.information_asset_manager,
] + (
list(dataset.data_catalogue_editors.all())
if hasattr(dataset, "data_catalogue_editors")
else []
)
if request.user not in valid_users and not request.user.is_superuser:
return HttpResponseForbidden()
return super().dispatch(request, *args, **kwargs)

Expand Down
5 changes: 5 additions & 0 deletions dataworkspace/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,11 @@ async def handler_with_sso_headers():
if me_profile:
return await handler_with_sso_headers()

request["logger"].info(
"Making request to SSO - %s%s",
sso_base_url,
me_path,
)
async with client_session.get(
f"{sso_base_url}{me_path}",
headers={"Authorization": f"Bearer {token}"},
Expand Down

0 comments on commit 26e57d8

Please sign in to comment.