Skip to content

Auth: Implementation of org access control #250

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

nishika26
Copy link
Collaborator

@nishika26 nishika26 commented Jun 26, 2025

Summary

Target issue is #155 and #154
Explain the motivation for making this change. What existing problem does the pull request solve?
These issues were clubbed together because the final product of both of them is to put access control on authenticated user so that they can only create or access their organization only.

Notes

  • Refactored Access and Creation Check Logic:

The check_org_access function has been introduced to streamline access control by handling both:

Access Control: Ensures that regular users can only access organizations they belong to. A 403 HTTP exception is raised if they attempt to access an unauthorized organization.

Organization Creation and deletion Permission: Only a superuser is allowed to do both of these

Note that a superuser still has access to everything.

  • for Users Logged in via Username and Password:

If a user logs in using their username and password, the system will search the API key table using the user's ID to retrieve the associated organization ID. Access is only granted to the organization linked to their user ID in the API key table.

This approach is necessary because, at present, the API key table serves as the only link between users and organizations.

Copy link

codecov bot commented Jun 26, 2025

Codecov Report

Attention: Patch coverage is 93.33333% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/app/api/routes/organization.py 75.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@nishika26 nishika26 changed the title access control Implementation of org access control Jun 26, 2025
@nishika26 nishika26 marked this pull request as ready for review June 27, 2025 06:35
Copy link
Collaborator

@vijay-T4D vijay-T4D left a comment

Choose a reason for hiding this comment

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

Approved. - good for merge

@nishika26 nishika26 removed the request for review from Ishankoradia June 30, 2025 09:06
@nishika26 nishika26 changed the title Implementation of org access control Auth: Implementation of org access control Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Auth : API Key Grants Access to Other Organizations' Data
4 participants