MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / is_user_admin_or_owner

Method is_user_admin_or_owner

app/api/agentops/opsboard/models.py:295–306  ·  view source on GitHub ↗

Check if a user is an admin or owner of this organization.

(self, user_id: str | UUID)

Source from the content-addressed store, hash-verified

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."""

Callers 15

update_orgFunction · 0.80
invite_to_orgFunction · 0.80
remove_from_orgFunction · 0.80
change_member_roleFunction · 0.80
update_member_licensesFunction · 0.80
validate_discount_codeFunction · 0.80
create_checkout_sessionFunction · 0.80
create_free_subscriptionFunction · 0.80
cancel_subscriptionFunction · 0.80
reactivate_subscriptionFunction · 0.80
get_subscription_detailFunction · 0.80
update_subscriptionFunction · 0.80

Calls 2

get_user_membershipMethod · 0.95
normalize_uuidFunction · 0.70

Tested by

no test coverage detected