Prevent remote sync if rbac sync is disabled (#7044)

Syncing from new rbac to old rbac locally calls the
disable_rbac_sync() context manager.

If rbac sync is disabled, we do not need to remote
sync, as we can assume the remote syncing already
occurred in the viewset.

Signed-off-by: Seth Foster <fosterbseth@gmail.com>
This commit is contained in:
Seth Foster
2025-08-05 12:39:56 -04:00
committed by thedoubl3j
parent 3e1b9b2c88
commit 7b56f23c0e

View File

@@ -679,6 +679,7 @@ def sync_members_to_new_rbac(instance, action, model, pk_set, reverse, **kwargs)
assignment = give_or_remove_permission(role, user, giving=is_giving, rd=rd)
# sync to resource server
if rbac_sync_enabled.enabled:
if is_giving:
maybe_reverse_sync_assignment(assignment)
else:
@@ -729,6 +730,7 @@ def sync_parents_to_new_rbac(instance, action, model, pk_set, reverse, **kwargs)
assignment = give_or_remove_permission(child_role, team, giving=is_giving, rd=rd)
# sync to resource server
if rbac_sync_enabled.enabled:
if is_giving:
maybe_reverse_sync_assignment(assignment)
else: