I'm developing an APP that has a API and a database that holds user permissions and user projects, among other things.
Certain stored procedures must be protected, and for that I have to check the scopes available for the user.
Should I check the user permissions inside the stored procedures (calling a second proc or function that would check if the user has a certain scope) or should I do two database calls from my endpoint, one to check if the user has the necessary scopes and a different one to execute the protected procedure?