Check if a user is an admin or owner of this organization.
(self, user_id: str | UUID)
| 293 | return self.get_user_membership(user_id) is not None |
| 294 | |
| 295 | def is_user_admin_or_owner(self, user_id: str | UUID) -> bool: |
| 296 | """Check if a user is an admin or owner of this organization.""" |
| 297 | # If we have the current user role set from summary queries, use that |
| 298 | if hasattr(self, '_current_user_role') and normalize_uuid(user_id) == normalize_uuid( |
| 299 | getattr(self, '_current_user_id', user_id) |
| 300 | ): |
| 301 | return self._current_user_role in [OrgRoles.owner, OrgRoles.admin] |
| 302 | |
| 303 | if membership := self.get_user_membership(user_id): |
| 304 | return membership.role in [OrgRoles.owner, OrgRoles.admin] |
| 305 | |
| 306 | return False |
| 307 | |
| 308 | def is_user_owner(self, user_id: str | UUID) -> bool: |
| 309 | """Check if a user is the owner of this organization.""" |
no test coverage detected