Skip to content

Commit 6471646

Browse files
committed
Add is_global_validator on user me endpoint
1 parent b44bd0f commit 6471646

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

api/drf_views.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,13 @@ def get_queryset(self):
13371337
name__iexact="IFRC Admins",
13381338
user=OuterRef("pk"),
13391339
)
1340-
)
1340+
),
1341+
is_local_unit_global_validator=models.Exists(
1342+
Group.objects.filter(
1343+
name__iexact="Local Unit Global Validators",
1344+
user=OuterRef("pk"),
1345+
)
1346+
),
13411347
)
13421348
.filter(is_active=True)
13431349
)

api/serializers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,9 @@ class Meta:
16471647
class UserSerializer(ModelSerializer):
16481648
profile = ProfileSerializer()
16491649
subscription = MiniSubscriptionSerializer(many=True)
1650+
# NOTE: This field is annotated in the viewset
16501651
is_ifrc_admin = serializers.BooleanField(read_only=True)
1652+
is_local_unit_global_validator = serializers.BooleanField(read_only=True)
16511653

16521654
class Meta:
16531655
model = User
@@ -1661,6 +1663,7 @@ class Meta:
16611663
"subscription",
16621664
"is_superuser",
16631665
"is_ifrc_admin",
1666+
"is_local_unit_global_validator",
16641667
)
16651668

16661669
def create(self, _):

0 commit comments

Comments
 (0)