Skip to content

Conversation

@dee077
Copy link
Member

@dee077 dee077 commented Nov 12, 2025

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #1157.

Description of Changes

  • Made a new ws endpoint location/all from base django-loci clases with updated user permissions.

Screen Recording

Screencast.from.2025-11-13.02-20-06.webm

@coveralls
Copy link

Coverage Status

coverage: 98.549% (-0.06%) from 98.607%
when pulling 5a91a30 on feature/1157-new-ws-endpoint-for-all-location
into faec934 on master.

@dee077 dee077 self-assigned this Dec 3, 2025
@dee077 dee077 added the gsoc Part of a Google Summer of Code project label Dec 3, 2025
Comment on lines 27 to 33
if (
result
and not user.is_superuser
and not user.is_manager(location.organization)
):
return False
return result
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (
result
and not user.is_superuser
and not user.is_manager(location.organization)
):
return False
return result
return result and (user.is_superuser or user.is_manager(location.organization))

Copy link
Member Author

Choose a reason for hiding this comment

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

I can make these changes, but then in LocationBroadcast above, we have the same logic written in 2 different ways!
We can change both or keep it as it is
Let me know which is better

@pandafy pandafy changed the base branch from master to gsoc25-map December 15, 2025 13:01
@dee077 dee077 force-pushed the feature/1157-new-ws-endpoint-for-all-location branch from 61709be to f843054 Compare December 18, 2025 19:34
Implemented a new websocket endpoint 'location/all/' with updated user permission from base clases from django-loci.

Fixes #1157
@dee077 dee077 force-pushed the feature/1157-new-ws-endpoint-for-all-location branch from f843054 to 75476f6 Compare December 18, 2025 19:36
@dee077 dee077 force-pushed the feature/1157-new-ws-endpoint-for-all-location branch 2 times, most recently from d6a09ed to ade9399 Compare December 23, 2025 12:56
@dee077 dee077 force-pushed the feature/1157-new-ws-endpoint-for-all-location branch from ade9399 to 9697b8b Compare December 23, 2025 13:14
@dee077
Copy link
Member Author

dee077 commented Dec 23, 2025

Updates

  • Added organization specific websocket groups so that authorized users can connect to the common location endpoint while receiving updates only for the organizations they manage unlike, the single-location endpoint enforces stricter authorization by rejecting the connection entirely if the user is not an admin or manager of the location’s organization.
  • Added tests

Build on top of openwisp/django-loci#193

@dee077 dee077 marked this pull request as ready for review December 23, 2025 13:22
@dee077 dee077 force-pushed the feature/1157-new-ws-endpoint-for-all-location branch from 0e91107 to f0f5305 Compare December 25, 2025 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement gsoc Part of a Google Summer of Code project

Projects

Development

Successfully merging this pull request may close these issues.

[feature] New ws endpoint for all all Location broadcast

4 participants