MCPcopy
hub / github.com/PostHog/posthog / join

Method join

posthog/models/user.py:199–216  ·  view source on GitHub ↗
(
        self, *, organization: Organization, level: OrganizationMembership.Level = OrganizationMembership.Level.MEMBER
    )

Source from the content-addressed store, hash-verified

197 return self.current_team
198
199 def join(
200 self, *, organization: Organization, level: OrganizationMembership.Level = OrganizationMembership.Level.MEMBER
201 ) -> OrganizationMembership:
202 with transaction.atomic():
203 membership = OrganizationMembership.objects.create(user=self, organization=organization, level=level)
204 self.current_organization = organization
205 if (
206 AvailableFeature.PROJECT_BASED_PERMISSIONING not in organization.available_features
207 or level >= OrganizationMembership.Level.ADMIN
208 ):
209 # If project access control is NOT applicable, simply prefer open projects just in case
210 self.current_team = organization.teams.order_by("access_control", "id").first()
211 else:
212 # If project access control IS applicable, make sure the user is assigned a project they have access to
213 # We don't need to check for ExplicitTeamMembership as none can exist for a completely new member
214 self.current_team = organization.teams.order_by("id").filter(access_control=False).first()
215 self.save()
216 return membership
217
218 @property
219 def notification_settings(self) -> Notifications:

Callers 15

jest.config.tsFile · 0.80
compareToReferenceImageFunction · 0.80
createEntryFunction · 0.80
printResponseFunction · 0.80
insightLogic.tsFile · 0.80
summarizeBreakdownFunction · 0.80
summarizeInsightFiltersFunction · 0.80
formatBreakdownLabelFunction · 0.80
PathsEventTypesFunction · 0.80
TrendsFormulaFunction · 0.80

Calls 3

filterMethod · 0.80
createMethod · 0.45
saveMethod · 0.45