I have an admin page that I want to restrict to an Admin or Super Admin role. When I restrict the security, I’m always getting the ‘unauthorized’ error when accessing the api.
Steps to reproduce
I created 5 different roles in my Security Provider
I’ve tried 2 different ways to define the role:
Using Equals
I login with an admin user and the response is pulling back my 403 screen. Note on this page the first API call uses a Security Restrict (all users), second has no security restrict, third has the security restrict options from the screenshot above:
Perhaps it is not clear for a lot of users, but there is a difference between permission and role based security. Wappler uses permission based, which means you tell which permissions are required (read AND write), while with role based you tell which roles are allowed to access (admin OR user). The difference is that with permissions it must match all while with roles it must match one of them.
So the behavior is not a bug, but I will have a look if we perhaps could update the security provider to support AND and OR for the restrictions.
I think you have the permission setup incorrectly. I see you set role as identity column (this should point to the column containing the user identity), I think this should be user_id seeing that it uses the user table.