def deposits_filter():
if not has_request_context() or admin_permission_factory().can():<EOL><INDENT>return Q()<EOL><DEDENT>else:<EOL><INDENT>return Q(<EOL>'<STR_LIT>', **{'<STR_LIT>': getattr(current_user, '<STR_LIT:id>', <NUM_LIT:0>)}<EOL>)<EOL><DEDENT>
Filter list of deposits.

    Permit to the user to see all if:

    * The user is an admin (see
        func:`invenio_deposit.permissions:admin_permission_factory`).

    * It's called outside of a request.

    Otherwise, it filters out any deposit where user is not the owner.