If what you mentioned happened with the agreement of the immediate boss and his superior, because there was not much work that would require you to put in full hours, and they had the authority to set the hours of work, then there is nothing wrong with that.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) was asked about a man who sought permission from his immediate boss to be absent from work, and he gave him permission. What is the ruling on his salary?
If you asked permission from him (i.e., your immediate boss) and you know that the work needs you to be present, then you should not accept this permission, and you have to be present at work even if you are given permission to be absent. But if the work does not need you and your immediate boss gives you permission, then I hope that there is nothing wrong with that. End quote.
Al-Baab al-Maftooh (14/question no. 17).
A similar answer was given by Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allaah have mercy on him). We have quoted his fatwa in the answer to question no. 85055.
And Allaah knows best.