Iranian security officials helped to plan Hamas’s Saturday surprise attack on Israel and gave the green light for the assault at a meeting in Beirut last Monday, according to senior members of Hamas and Hezbollah, another militant group that is backed by Iran.