Is there a way to check a user's permission in Google Sheets?

I'm trying to find information about it but I have not really managed to find an answer.

Is there a way in Google Sheets to check, through scripts, the permissions of a user for the sheet?

My permissions, I mean if the user is able to view, edit or comment on the file.

For example, I'm wondering if I could create a script for a sheet in which the script only fires if the user trying to trigger it is a user who can edit the sheet. If a user who can comment or simply display the sheet tries to activate the script, it does not matter.