MCPcopy Index your code
hub / github.com/Flagsmith/flagsmith / create

Method create

api/users/serializers.py:27–37  ·  view source on GitHub ↗
(self, validated_data)

Source from the content-addressed store, hash-verified

25 pass
26
27 def create(self, validated_data): # type: ignore[no-untyped-def]
28 organisation = Organisation.objects.get(pk=self.context.get("organisation"))
29 user = self._get_user(validated_data) # type: ignore[no-untyped-call]
30
31 if user and organisation in user.organisations.all():
32 user.remove_organisation(organisation)
33 user.permission_groups.remove(
34 *UserPermissionGroup.objects.filter(organisation=organisation)
35 )
36
37 return user
38
39 def validate(self, attrs): # type: ignore[no-untyped-def]
40 if not FFAdminUser.objects.filter(pk=attrs.get("id")).exists():

Callers 15

index.jsFile · 0.45
add_organisationMethod · 0.45
add_to_groupMethod · 0.45
staff_userFunction · 0.45
organisationFunction · 0.45
user_permission_groupFunction · 0.45
tagFunction · 0.45
system_tagFunction · 0.45
projectFunction · 0.45
project_bFunction · 0.45

Calls 4

_get_userMethod · 0.95
remove_organisationMethod · 0.80
getMethod · 0.45
allMethod · 0.45

Tested by 15

staff_userFunction · 0.36
organisationFunction · 0.36
user_permission_groupFunction · 0.36
tagFunction · 0.36
system_tagFunction · 0.36
projectFunction · 0.36
project_bFunction · 0.36
segmentFunction · 0.36
another_segmentFunction · 0.36
segment_ruleFunction · 0.36
feature_specific_segmentFunction · 0.36