Page Security Restrict

I am struggling with setting page security restrictions. I have setup a database in security provider

i have just one role but will need more roles in future. On my page I have this set

and my tbl_users has the following data

image

but when I log that user in, it diverts to the unauthorised page . The user is definently logged in, but I can’t see what I’m doing wrong. As i have some deadlines to meet I am setting the page access permission to ‘any’ as a workaround. I have checked against the Demo Projects HQ and it looks identical. Has anyone any thoughts or is there any JS config scripts I can look at to check what I’m doing wrong?

Hi @Journeyman,
I am facing the exact same issue. My setup is the same as yours, it looks identical as the Demo Projects HQ. But I am getting a “302 Found” status code when I am logged in as an admin and try to access the /admin page.

And no problem with the “Any” permission either.

Did you find what was wrong? Or anyone could guide us please.

Thanks !

Hi

I have done quite a lot of searching around and comparing code on this, one thing I found was in the way the routes file was being saved when you change the security conditions on the individual page. So when i changed or added permissions on the page

and then I looked in the routes.js file (app/config)
"path": "/Payments/allPayments2",

"page": "Payments/allPayments2",

"routeType": "page",

"layout": "lh_menu_3",

"restrict": {

"provider": "security",

"permissions": "admin",

"loginUrl": "/login/login",

"forbiddenUrl": "/unauthorized"

}

I noticed the permissions line should actually read “permissions”: [“admin”], ie list array note square brackets. I edited the file manually.

This was on the local host and it worked ok, I may be talking rubbish but that’s what has worked for me

I haven’t been able to get it working on my remote staging server which is on Digital Ocean droplet , but I think there are other issues , which i’m investigating and will report later

Hope that helps

It should indeed be an array instead of a string. The permissions are wrongly generated when edited in the App Properties panel. Will be fixed in the next update.

2 Likes

Nice catch @Journeyman !

Thank you for your help guys.

Fixed in Wappler 7.8.0

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.