-
Notifications
You must be signed in to change notification settings - Fork 8
Allow shared users to connect to ws #246
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
Conversation
realtime/consumers.py
Outdated
| return | ||
|
|
||
| if rover.owner.id != user.id: | ||
| shared_user_ids = [user.id for user in rover.shared_users.all()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't practice much with the Django ORM. Is there a better way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do something like:
is_shared_user = rover.shared_users.filter(id=user.id).exists()
realtime/consumers.py
Outdated
| return | ||
|
|
||
| if rover.owner.id != user.id: | ||
| shared_user_ids = [user.id for user in rover.shared_users.all()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do something like:
is_shared_user = rover.shared_users.filter(id=user.id).exists()
| local_ip='8.8.8.8', | ||
| oauth_application=oauth_app, | ||
| ) | ||
| rover.shared_users.set([shared_user]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be .add if you don't want to have to make it a list
cabarnes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
This makes the websocket security check allow shared users. I realized I forgotten about this in the last shared-users PR.