Full Sharh — Mishkat al-Masabih 3572
عَنْ أَبِي الشَّمَّاخِ الْأَزْدِيِّ عَنِ ابْنِ عَمٍّ لَهُ مِنْ أَصْحَابِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ أَنَّهُ أَتَى مُعَاوِيَةَ فَدَخَلَ عَلَيْهِ فَقَالَ: سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ: «مَنْ وَلِيَ مِنْ أَمْرِ النَّاسِ شَيْئًا ثُمَّ أَغْلَقَ بَابَهُ دُونَ الْمُسْلِمِينَ أَوِ الْمَظْلُومِ أَوْ ذِي الْحَاجَةِ أَغْلَقَ اللَّهُ دُونَهُ أَبْوَابَ رَحْمَتِهِ عِنْدَ حَاجَتِهِ وَفَقْرِهِ أَفْقَرَ مَا يَكُونُ إليهِ»
English Translation
Abush Shammakh al-Azdi was told by a cousin of his on his father’s side who was a companion of the Prophet that he had gone to Mu'awiya, entered his presence and told him he had heard God's Messenger say, "If one who has been given any authority over the people locks his gate against Muslims, or one who has been wronged, or one who has a need, God will lock the gates of His mercy against him when he has a need or is in poverty, however much he is in need of Him.” Baihaqi transmitted in Shuab al iman.
Source
Mishkat al-Masabih(مشكاة المصابيح)
The Offices of Commander and Qadi
Hadith Number
3572