Skip to content

Commit 707a22a

Browse files
Simplify if condition for serializer
Co-authored-by: John Westcott IV <[email protected]>
1 parent cab35b0 commit 707a22a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ansible_base/rbac/api/serializers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def validate(self, attrs):
125125
has_actor_in_request = self.actor_field in self.initial_data
126126
has_actor_aid_in_request = actor_aid_field in self.initial_data
127127

128-
if (has_actor_in_request and has_actor_aid_in_request) or (not has_actor_in_request and not has_actor_aid_in_request):
128+
# If both actor and actor_ansible_id are present or both not present than we error out
129+
if has_actor_in_request == has_actor_aid_in_request:
129130
self.raise_id_fields_error(self.actor_field, actor_aid_field)
130131

131132
return super().validate(attrs)

0 commit comments

Comments
 (0)