mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 22:16:00 -03:30
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:
@@ -679,10 +679,11 @@ 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 is_giving:
|
||||
maybe_reverse_sync_assignment(assignment)
|
||||
else:
|
||||
maybe_reverse_sync_unassignment(rd, user, role.content_object)
|
||||
if rbac_sync_enabled.enabled:
|
||||
if is_giving:
|
||||
maybe_reverse_sync_assignment(assignment)
|
||||
else:
|
||||
maybe_reverse_sync_unassignment(rd, user, role.content_object)
|
||||
|
||||
|
||||
def sync_parents_to_new_rbac(instance, action, model, pk_set, reverse, **kwargs):
|
||||
@@ -729,10 +730,11 @@ 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 is_giving:
|
||||
maybe_reverse_sync_assignment(assignment)
|
||||
else:
|
||||
maybe_reverse_sync_unassignment(rd, team, child_role.content_object)
|
||||
if rbac_sync_enabled.enabled:
|
||||
if is_giving:
|
||||
maybe_reverse_sync_assignment(assignment)
|
||||
else:
|
||||
maybe_reverse_sync_unassignment(rd, team, child_role.content_object)
|
||||
|
||||
|
||||
ROLE_DEFINITION_TO_ROLE_FIELD = {
|
||||
|
||||
Reference in New Issue
Block a user