Check if a user is the owner of this organization.
(self, user_id: str | UUID)
| 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.""" |
| 310 | # If we have the current user role set from summary queries, use that |
| 311 | if hasattr(self, '_current_user_role') and normalize_uuid(user_id) == normalize_uuid( |
| 312 | getattr(self, '_current_user_id', user_id) |
| 313 | ): |
| 314 | return self._current_user_role == OrgRoles.owner |
| 315 | |
| 316 | if membership := self.get_user_membership(user_id): |
| 317 | return membership.role == OrgRoles.owner |
| 318 | |
| 319 | return False |
| 320 | |
| 321 | @classmethod |
| 322 | def get_by_id(cls, orm: orm.Session, org_id: str | UUID) -> Optional['OrgModel']: |
no test coverage detected