|
Rank: Newbie Groups: Member
Joined: 2/2/2008 Posts: 5
|
I know how to allow specific roles to see a menu item, but how do you allow all roles to see it? In other words, if a user is logged on, it's visible, else, no. Thanks for any help.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You can set AlloweRoles to "*" to do that. These are all valid values:
1. Leave it empty. All visitors, regardless logged in or not, are allowed; 2. "*" (without quotation marks), only logged in users are allowed. This is your case; 3. "?" (without quotation marks), only anonymous users are allowed; 4. A list of real roles;
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 2/2/2008 Posts: 5
|
I have tried the *, with no success. It still allows all viewing, even if not logged in. I am using V3.1.11.2 if it makes a difference.
Any idea on what may be the problem?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That appears to be a bug. We will see if we can get it fixed as soon as possible.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 2/2/2008 Posts: 5
|
Thank you for your quick replies!
Will you post when you get the bug fixed? Or how does that work?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Yes. We will reply in the forum and also provide you the download location of the new build. You MAY need a new license for the new build though because it would be for the current release, which is 2007.2. If you do not have a license for the current release, you can use the following code:
Code: Visual Basic.NET
Private Sub Page_Load( _
ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim isAnonymous As Boolean = _
Not (HttpContext.Current.User Is Nothing) And _
Not (HttpContext.Current.User.Identity Is Nothing) And _
Not HttpContext.Current.User.Identity.IsAuthenticated
DisableItems(Menu1.Items, isAnonymous)
End Sub
Private Sub DisableItems( _
ByVal items As EO.Web.MenuItemCollection, _
ByVal isAnonymous As Boolean)
Dim item As EO.Web.MenuItem
For Each item In items
If item.AllowRoles = "*" And isAnonymous Then
item.Disabled = True
End If
DisableItems(item.SubMenu.Items, isAnonymous)
Next
End Sub
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 2/2/2008 Posts: 5
|
EXCELLENT!!!
I must say a huge thank you, as well as how much I appreciate the prompt, and helpful support.
WELL DONE!
The code that you supplies works as a patch until the new build comes out.
Thanks again, RocketDawg.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We have posted a new build that fixed this issue. Please see your private messages for download location.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 2/8/2008 Posts: 1
|
If I set AllowRoles="" then all users can see the menu item If I set AllowRoles="?" no users can see the menu item If I set AllowRoles="Administrator" only admin users can see the menu item
I need to set a menu item that only anonymous users can see it, am I missing something in my web.config?
I have it working find for Set Roles in dedicated sub directories, but now I want only anonymous users to see a menu item and page for a specific file in the root.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Justin,
In your case, you would set all the items who you do not want anonymous users to see as "*", and leave other items blank. You can then use the sample code provided in the previous post to translate AllowRoles into MenuItem.Enabled/Visible.
Thanks
|
|