09 Jun 2009
23 Apr 2010
Link to this post
I am sorry I didn't make the issue clearly described.
Let me try again,
1. We have a separate authentication system to verify which user is logged in and his role, those user accounts are in another database and we DONOT want to import them into Sitefinity; the authentication code is written in the master page;
2. Our navigation control is simply using a treeview, and in code behind we work on Sitemap class to produce the menu items;
3. In Sitefinity, we added 'agent' role and 'agentonly' user, and assign view permission for those pages that can only be viewed by the 'agent' role;
4. Our goal is: if a user logs in by the separated authentication system described in 1, he will be able to see all the public pages and 'agent' only pages; if a user doesn't log in, then he can only see public pages
5. Currently we use a different template master page for 'agent' only pages, in this master page we verify the user's role and decide whether to show the content, it is working properly
6. The issue is: our navigation contorl is always showing the public pages only, because the Sitemap only returns the nodes that are viewable for everyone (If we use sitefinity login page to log in as 'agentonly' user, then the Sitemap returns the pages that we want)
So the possible solution may be: in our code behind when authenticating the logged in user, if his role is 'agent', then programmatically log in sitefinity as 'agentonly' user, then generate the navigation tree, and after that, programmatically log out 'agentonly' user.
However we don't know how to "programmatically log in / log out sitefinity".
Or if you have other better options, please let me know.
I hope that explain our issue clearly.