As we all know, in Iran the supreme leader has the last word over the entire political system; with the president as the second highest leader.
According to the law the president doesn't have the authority to appoint the chief of army or the commander of revolutionary guard.
The president of Iran has much less power than a president or prime minister in a democratic country.
The real power in Iran is with the theocratic Assembly of Experts.
These are former religious leaders and elected parliament members with long political careers.
They appoint the Supreme Leader and the Guardians Council.
The Supreme Leader is in charge of the military and judges.