They ban demonstrations that are very likely to facilitate hateful incitement against religious and ethnic groups or are organized by people who held demonstrations where that happened a lot. The relevant law is called "Volksverhetzung" (Incitement against a people).
There are numerous demonstrations in favour of Palestine and the Gaza population in Germany rn, the bans target a minority of the pro-palestine demonstrations.
It is still problematic in the sense that the state and police have the power of definition here, on the other hand there were numerous demonstrations under the impression of prior conflicts of the region where hundreds of men would shout "Gas the Jews" in german cities and violently attack anyone wearing a kippah or other jewish (not even Zionist) symbols