Skip to content

Commit

Permalink
Add is_global_validator on user me endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
susilnem committed Jan 28, 2025
1 parent b44bd0f commit 6471646
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/drf_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,13 @@ def get_queryset(self):
name__iexact="IFRC Admins",
user=OuterRef("pk"),
)
)
),
is_local_unit_global_validator=models.Exists(
Group.objects.filter(
name__iexact="Local Unit Global Validators",
user=OuterRef("pk"),
)
),
)
.filter(is_active=True)
)
Expand Down
3 changes: 3 additions & 0 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,9 @@ class Meta:
class UserSerializer(ModelSerializer):
profile = ProfileSerializer()
subscription = MiniSubscriptionSerializer(many=True)
# NOTE: This field is annotated in the viewset
is_ifrc_admin = serializers.BooleanField(read_only=True)
is_local_unit_global_validator = serializers.BooleanField(read_only=True)

class Meta:
model = User
Expand All @@ -1661,6 +1663,7 @@ class Meta:
"subscription",
"is_superuser",
"is_ifrc_admin",
"is_local_unit_global_validator",
)

def create(self, _):
Expand Down

0 comments on commit 6471646

Please sign in to comment.