This is a migrated thread and some comments may be shown as answers.

[Solved] Custom Authorization of menu items (Hide Unauthorized menu items)

3 Answers 114 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kamyar Paykhan
Top achievements
Rank 1
Kamyar Paykhan asked on 26 Apr 2011, 09:59 AM
I have implemented a custom access level provider for my MVC application. Basically each user has an "AccessLevels" property of type int which is bitwise-compared to an enum. e.g.(User.AccessLevels & CanAccessReports) return 1 (true) if the flag in AccessLevels property is set. 
Is there anyway that I can bind Telerik menu to a sitemap and implement my custom access level permissions to hide items that user cannot have access to? (Maybe by overriding a method?)
P.S. I do not want to use a role based approach since I don't want to define dozens of roles for the site and assign users to them.
Thank you.

3 Answers, 1 is accepted

Sort by
0
nachid
Top achievements
Rank 1
answered on 26 Apr 2011, 10:46 AM
The menu component has a Visible property you can use this way

menu.Add().Text("Any Item Menu")
         
.Visible(User.AccessLevels & CanAccessReports)
0
Kamyar Paykhan
Top achievements
Rank 1
answered on 27 Apr 2011, 06:56 PM
Thank you nachid. Is there any way that I can bind the menu to the sitemap and use this feature?
0
nachid
Top achievements
Rank 1
answered on 27 Apr 2011, 11:33 PM
Sorry, I never tried to bind sitemap to menu and I cannot say
Tags
Menu
Asked by
Kamyar Paykhan
Top achievements
Rank 1
Answers by
nachid
Top achievements
Rank 1
Kamyar Paykhan
Top achievements
Rank 1
Share this question
or