8000 Capability to access user shared data by cgoina · Pull Request #9 · JaneliaSciComp/fileglancer-central · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Capability to access user shared data #9

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

Jump to bottom
Merged
merged 3 commits into from
May 16, 2025
Merged

Capability to access user shared data #9

merged 3 commits into from
May 16, 2025

Conversation

cgoina
Copy link
Contributor
@cgoina cgoina commented May 16, 2025

Created a UserContext that allows accesing shared data.

@@ -53,14 +54,14 @@ def cache_wiki_paths(confluence_url, confluence_token, force_refresh=False):



def get_file_proxy_client(sharing_key: str, sharing_name: str) -> FileProxyClient | Response:
def _get_file_proxy_client(sharing_key: str, sharing_name: str) -> FileProxyClient | Response:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer this convention - it gives me the illusion the method is used only in this file. Let me know if you want me to revert it

return False


def main():
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this in here - because I just did some additional testing but it can be removed

logger.debug("Release user context")
os.seteuid(self._uid)
os.setegid(self._gid)
self._user = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also revert groups?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably should - I will do that too

if isinstance(client, Response):
return client
return await client.head_object(path)
with userctx:
Copy link
Member

Choose a reason for hiding this comment

8000 The reason will be displayed to describe this comment to others. Learn more.

Very elegant!

Copy link
Member
@neomorphic neomorphic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

logger.error(f"Failed to set the effective gid: {e}")
raise e

try:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krokicki on my mac I ran into an exception when I tried to restore the groups - the number of groups my root has on mac is larger than the number allowed to set. So I added this check just to see if this happens

@cgoina cgoina merged commit ffb3777 into main May 16, 2025
@cgoina cgoina deleted the shared-fileproxy branch May 16, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0