MCPcopy Index your code
hub / github.com/fastapi-users/fastapi-users / update

Method update

fastapi_users/manager.py:440–467  ·  view source on GitHub ↗

Update a user. Triggers the on_after_update handler on success :param user_update: The UserUpdate model containing the changes to apply to the user. :param user: The current user to update. :param safe: If True, sensitive values like is_superuser or

(
        self,
        user_update: schemas.UU,
        user: models.UP,
        safe: bool = False,
        request: Request | None = None,
    )

Source from the content-addressed store, hash-verified

438 return updated_user
439
440 async def update(
441 self,
442 user_update: schemas.UU,
443 user: models.UP,
444 safe: bool = False,
445 request: Request | None = None,
446 ) -> models.UP:
447 """
448 Update a user.
449
450 Triggers the on_after_update handler on success
451
452 :param user_update: The UserUpdate model containing
453 the changes to apply to the user.
454 :param user: The current user to update.
455 :param safe: If True, sensitive values like is_superuser or is_verified
456 will be ignored during the update, defaults to False
457 :param request: Optional FastAPI request that
458 triggered the operation, defaults to None.
459 :return: The updated user of type models.UP.
460 """
461 if safe:
462 updated_user_data = user_update.create_update_dict()
463 else:
464 updated_user_data = user_update.create_update_dict_superuser()
465 updated_user = await self._update(user, updated_user_data)
466 await self.on_after_update(updated_user, updated_user_data, request)
467 return updated_user
468
469 async def delete(
470 self,

Callers 2

authenticateMethod · 0.45
_updateMethod · 0.45

Calls 4

_updateMethod · 0.95
on_after_updateMethod · 0.95
create_update_dictMethod · 0.80

Tested by

no test coverage detected