You are viewing a single comment's thread from:

RE: [KnackSteem API] - More features added

in #utopian-io7 years ago

Thanks for the contribution, @jaysermendez! Since the isModerator and isSupervisor functions are identical apart from one line, wouldn't it be better to combine them into one function?

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.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Sort:  

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.