Is there a way to show/hide an item in the menu depending upon the role or depending upon if you are logged into or not?
Do you mean the menu item on the website or inside edit mode?
If inside the website, you can check out AlloyTech templates, there you have helpers for rendering a menu. They take the role into account. Take a look at public static IHtmlString MenuList, specifically the call to FilterForDisplay.
If you are talking about edit mode, check out this post, but make sure to read the comments!
Yes I am talking about the menu inside the website. The issue I was having was because of the custom login for website users I have made. And there I was having issue setting roles etc as the user was being authenticated through an external api and not the standard way in Episerver
Then you have a bit bigger issue than menus in particular. You need to set your authentication and authorization architecture, so that Episerver understand the user and its roles. I would advise you to put time to it, given that more things might not work for you later on.
If you are using Owin, you should be setting user and role claims based on external authentication. If not so, a membership and role provider implementation should be done.
Then, the rest requires no special approach, it will work with Alloy-like code.
Yes I think I have covered the authentication properly usin OWIN middelware. There I have a handler which handles the login using the api and then I add roles and claims.
Then it should work with FilterForDisplay...
You could implement the Owin part to Alloy to debug that and see where the problem is, but for me, it's difficult to help you without further info...