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

Method update_role

api/users/views.py:138–151  ·  view source on GitHub ↗
(self, request, organisation_pk, pk)

Source from the content-addressed store, hash-verified

136
137 @action(detail=True, methods=["POST"], url_path="update-role")
138 def update_role(self, request, organisation_pk, pk): # type: ignore[no-untyped-def]
139 user = self.get_object()
140 organisation = Organisation.objects.get(pk=organisation_pk)
141 user_organisation = user.get_user_organisation(organisation)
142
143 serializer = self.get_serializer(
144 instance=user_organisation, data=request.data, partial=True
145 )
146 serializer.is_valid(raise_exception=True)
147 serializer.save()
148
149 return Response(
150 UserListSerializer(user, context={"organisation": organisation}).data
151 )
152
153
154def password_reset_redirect(

Callers

nothing calls this directly

Calls 6

UserListSerializerClass · 0.90
get_user_organisationMethod · 0.80
is_validMethod · 0.80
get_objectMethod · 0.45
getMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected