|
|
|
|
@ -263,10 +263,11 @@ def handle_shared_with_changes(sender, instance, action, pk_set, **kwargs): |
|
|
|
|
# print(f'm2m changed = {pk_set}') |
|
|
|
|
users = User.objects.filter(id__in=pk_set) |
|
|
|
|
|
|
|
|
|
if action == "post_add": |
|
|
|
|
instance.create_access_log(users, 'SHARED_ACCESS') |
|
|
|
|
elif action == "post_remove": |
|
|
|
|
instance.create_access_log(users, 'REVOKED_ACCESS') |
|
|
|
|
with transaction.atomic(): |
|
|
|
|
if action == "post_add": |
|
|
|
|
instance.create_access_log(users, 'SHARED_ACCESS') |
|
|
|
|
elif action == "post_remove": |
|
|
|
|
instance.create_access_log(users, 'REVOKED_ACCESS') |
|
|
|
|
|
|
|
|
|
device_id = device_registry.get_device_id(instance.id) |
|
|
|
|
websocket_sender.send_message(pk_set, device_id) |
|
|
|
|
|