smorest_crud.access_control.utils module

smorest_crud.access_control.utils.get_for_current_user_or_404(model, id_value)[source]

Get an object by unique column and check if the current user can read it. :type model: Type[~T] :param model: date base model of the instance :type id_value: Union[str, int] :param id_value: the id value of the interested instance

Return type

Optional[~T]

smorest_crud.access_control.utils.query_for_current_user(model)[source]

Get query for the current authorized user using access checks. :type model: Type[~T] :param model: date base model of the instance

Return type

AccessControlQuery