People are upon 4 levels regarding the circumstances of affliction:
The First Level: Being angry, and this is in various ways:
The first type: That the anger is by the heart as if he is angry at his Lord. So he becomes angry with what Allaah has decreed for him, and this (level) is haraam. And it is possible that this could lead to kufr (disbelief). Allaah said: “And among mankind is he who worships Allaah as it were, upon the very edge (i.e. in doubt); if good befalls him, he is content therewith; but if a trial befalls him, he turns back on his face (i.e. reverts back to disbelief after embracing Islaam). He loses both this world and the Hereafter.” - Al-Hajj (22):11
The second type: That the anger is by the tongue like making duaa for destruction or ruin and what is similar to that, and this is haraam.
The third type: That the anger is by the limbs like slapping the cheeks, ripping the clothes, pulling out hair, and similar to that, and all of this is haraam in contradiction to patience which is waajib (obligatory).
The Second Level: Being patient, just as the poet said:
“Patience is like its name - bitter in taste, yet its outcomes are sweeter than honey.”
So the person sees this thing (the affliction) weighs very heavy upon him, yet he bears it although he dislikes that it happened. Rather, his eemaan bears it and restrains him from being angry. So the time of affliction and the time of no affliction is not the same to him, and this (level) is waajib, because Allaah commanded the people to be patient, saying: “…and be patient. Surely, Allaah is with those who are As-Saabireen (the patient ones, etc.).” - Al-Anfaal (8):46
The Third Level: Being pleased with the affliction in that the person is pleased with the affliction and whether it happened or not, it is the same to him so he it is not difficult upon him. He does not bear it as if it is something weighing heavy on him, and this (level) is mustahabb (preferred - between haraam and waajib) and it is not waajib according to the most correct opinion. The difference between this level and the one before it is apparent because the affliction happening or not happening is the same due to the pleasure of the one on this level. As for the level before it, the affliction is hard upon him, yet he remains patient over it.
The Fourth Level: Thanking/being grateful and this is the highest level. This is that the person thanks Allaah for the affliction which has struck him in that he knows that this affliction is an expiation for his sins and perhaps a cause for an increase in his good deeds. The Prophet (صلى الله عليه وسلم) said:
“There is no affliction which strikes the Muslim except that Allaah expiates with it (sins), even with a thorn that may poke him.” (Recorded by Bukhaari and Muslim)