Many times while developing custom parts in BBIS the following question comes up: “How do I require a user to be logged in?”
Like a lot of things in BBIS this isn’t so obvious unless you know the API or you know how to do it from the front-end.
Fortunately this is made easy through the API by calling the following:
If it’s true then they aren’t logged in and you can bubble up a friendly message to the user.
To do this from the front-end it’s a small bit of configuration on the part itself. You’ll do this by editing your part and going to the “Targeting & security” tab (this tab exists on all parts). Make sure that there isn’t a check in the “View” column for the “Everyone” row. This allows the page to still load but will not show the part if the user is not logged in. If you want the page to not even be displayed or redirect the user then you will want to change the security for that particular page.