def with_project_permissions(
    project: Project, staff_user: FFAdminUser
) -> WithProjectPermissionsCallable:
    """
    Add project permissions to the staff_user fixture.
    Defaults to associating to the project fixture.
    """

    def _with_project_permissions(
        permission_keys: list[str] | None = None,
        project_id: typing.Optional[int] = None,
        admin: bool = False,
    ) -> UserProjectPermission:
        project_id = project_id or project.id
        upp, __ = UserProjectPermission.objects.get_or_create(
            project_id=project_id, user=staff_user, admin=admin
        )

        if permission_keys:
            upp.permissions.add(*permission_keys)  # type: ignore[arg-type]

        return upp

    return _with_project_permissions

    Add project permissions to the staff_user fixture.
    Defaults to associating to the project fixture.
    
api/conftest.py