Limiting page access based on some criteria

Hi, testing out some simple security aspects of AppGyver and not seeing how to do this.

If I have a security system that limits access to certain pages depending on the user’s access level, how do I not display those pages in the navigation menu or reject access to it if a non-authorised user tries to go to the page?

Just to make it simple, I have an App Variable called authUser which has a boolean property called isAdmin. I have a page called Users which only a user who isAdmin can access.

1 Like

Current navigation editor doesn’t allow you to hide the item from navigation for only some users. This should be possible in the upcoming advanced navigation editor, but that’s still some weeks into the future.

Now you can use Page focused event to test your isAdmin variable value. If it’s false, use Navigate back Flow function immediately.

Thanks, that could work for now.

I added an if condition after the Page focused and set it to IF authuser.isAdmin and set the next flow to the lower link (the false section) to the Navigate Back but it is not navigating back.

Hi! I would recommend building a custom navigation menu as I’m unsure what navigating back would do on the bottom of the navigation stack (which is a navigation menu item). Another option is just to hide all the content on the page for non-admin and showing e.g. “This content is restricted” warning instead.

Hi Mevi, so don’t use the built in AppGyver navigation but create my own control with buttons for each page I want the user to have access to?

If I do this, is there a way to force all pages to have this control on it (like using a template)?

Yeah, if you create your own controls you have full control of what to show and when.

Well, not really. You need to copy paste the menu to all pages it should be on. If you want to make changing styles easier for you, use shared styles for the menu, so then when you change the shared style for one, you will change them all.

OK, thanks very much