Skip to content

Conversation

@JKaram
Copy link
Contributor

@JKaram JKaram commented Feb 2, 2026

This pull request adds support for cleaning up sessions created by users with shared access to a project when the project is deleted. Previously, only the project owner's sessions were deleted; now, sessions for all shared users are also soft-deleted. The changes include updates to the resource sharing service interface, implementation in the default sharing service, the project deletion logic, and comprehensive tests for these scenarios.

Project deletion logic improvements

  • Updated soft_delete_project in project_service.py to also delete sessions for users with shared access to the project, not just the owner, by calling get_shared_users and iterating over each shared user. After all sessions are deleted, share records are also removed.

Resource sharing service interface and implementation

  • Added an abstract get_shared_users method to the ResourceSharingService interface, which returns a list of user emails with shared access to a resource.
  • Implemented get_shared_users in DefaultResourceSharingService, returning an empty list for community edition (no sharing).

Testing: Integration and unit tests

  • Added a new integration test suite test_projects_shared_session_deletion.py to verify that project deletion properly cleans up sessions for both owners and shared users, including edge cases and multiple shared users.
  • Added a unit test for get_shared_users in the default sharing service, confirming it returns an empty list for community edition.

Testing: Infrastructure helpers

  • Added get_sessions_for_project to DatabaseInspector to fetch sessions by project, supporting checks for deleted and non-deleted sessions.
  • Added seed_session_for_project to GatewayAdapter to help set up test data by creating sessions associated with projects and users.

rudraneel-chakraborty and others added 24 commits January 2, 2026 17:02
- Fix bug where can_access_resource() returned True instead of False
- Community edition has no sharing, so users cannot access resources
  via sharing - access is determined solely by ownership
- Add 7 unit tests verifying stub behavior:
  - test_share_resource_returns_false
  - test_unshare_resource_returns_false
  - test_can_access_resource_returns_false
  - test_get_shared_resources_returns_empty_list
  - test_check_user_access_returns_none
  - test_get_resource_collaborators_returns_empty_list
  - test_delete_resource_shares_returns_true

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…tion

- Added  method to  to retrieve users with shared access.
- Updated  to delete sessions for both project owners and shared users upon project deletion.
- Created integration tests to validate session deletion behavior for both owner and shared users.
- Added unit test to ensure  returns an empty list for community edition.
@JKaram JKaram changed the base branch from main to JKaram/DATAGO-119348/project-sharing February 2, 2026 22:05
Base automatically changed from JKaram/DATAGO-119348/project-sharing to main February 3, 2026 18:02
@JKaram JKaram marked this pull request as ready for review February 5, 2026 03:16
@sonarqube-solacecloud
Copy link

@JKaram JKaram merged commit c913b40 into main Feb 9, 2026
28 checks passed
@JKaram JKaram deleted the JKaram/DATAGO-115145/add_session_deletion branch February 9, 2026 18:26
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.

2 participants