(contacts) add "abilities" to API endpoint data

Returns the possible actions to the frontend using the
model's `get_abilities`.
This commit is contained in:
Quentin BEY
2024-12-06 11:57:58 +01:00
committed by BEY Quentin
parent 7154a491f4
commit 6fde76fb46
8 changed files with 37 additions and 14 deletions

View File

@@ -196,8 +196,8 @@ class Contact(BaseModel):
For now, we still consider here, a contact without owner is "public"
so we allow access to it.
"""
is_owner = user == self.owner
is_profile_member_or_same_organization = bool(self.user) and (
is_owner = user.pk == self.owner_id
is_profile_member_or_same_organization = bool(self.user_id) and (
self.user.organization_id == user.organization_id
)