| 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(): |