isModerator
and isSupervisor
functions are identical apart from one line, wouldn't it be better to combine them into one function?Thanks for the contribution, @jaysermendez! Since the
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Chat with us on Discord.
[utopian-moderator]Need help? Write a ticket on https://support.utopian.io/.
Even they are identical, if I combine them, mods will have supervisors rights and it is something we don't want :D. While supervisors can do everyrhing, mods cannot. So, if I combine them, mods will have access to supervisors endpoints as well
Yes I know, but surely there is a better way of checking a user's role instead of duplicating all the code?
Now that you mentioned, it can be done with a function that takes the role as the parameter :D i will do that.