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

Menu Showing not Authorized when using ADGroup Security

10 Answers 82 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.
Aleksander
Top achievements
Rank 1
Aleksander asked on 31 May 2012, 05:50 PM
I am populating the menu as below in the site.master

<% Html.Telerik().Menu()
                                   .Name("tmNav")
                                   .Items(menu =>
                                   {
                                       menu.Add()
                                           .Text("Home")
                                           .Action("Index", "GreenHome", new { area = "" });
                                       menu.Add()
                                          .Text("Perform QA")
                                          .Action("Index", "PerformQa", new { area = "PerformQa" });
                                       menu.Add()
                                          .Text("My Pending Actions")
                                          .Action("MyPendingActions", "PerformQa", new { area = "PerformQa" });
                                       menu.Add()
                                           .Text("Form Manager")
                                           .Action("Index", "Form", new { area = "Admin" });
                                   })
                                   .HtmlAttributes(new { style = "zoom:1;float:left;" })
                                   .Render();
                            %>

Then my controllers and/or actions have AD Security on them for example 
[ADGroupAuthorize(Roles = "QA TECH,QA MANAGER,ADMIN")]

However, What I want the menu to do is just not show the links that the people aren't able to access instead right now if they don't have access to any one of them they get a Not Authorized attribute.

How can I make it just show what they have access to?

10 Answers, 1 is accepted

Sort by
0
Aleksander
Top achievements
Rank 1
answered on 04 Jun 2012, 03:03 PM
Ok so I've fixed the issue, however, now I get a new one. I can show/hide the apporpriate buttons on the home page but when I click any of the Authorized links it shows all menu items on that new page.
0
Georgi Krustev
Telerik team
answered on 05 Jun 2012, 06:48 AM
Hello Aleksander,

 
Thank you for contacting us. I suppose that the "ADGroupAuthorize" attribute is custom authorization attribute,
which overrides the OnAuthorization method. If this is the case, note that you will need to return 

HttpUnauthorizedResult object. Thus the menu will know that the url is not allowed and the menu item will not shown. If you return a regular ActionResult, then the menuwill show the items.

Kind regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Aleksander
Top achievements
Rank 1
answered on 05 Jun 2012, 04:14 PM
Can you please provide and example of how this would work?
0
Aleksander
Top achievements
Rank 1
answered on 05 Jun 2012, 06:37 PM
I've put this in and still no luck.
0
Aleksander
Top achievements
Rank 1
answered on 05 Jun 2012, 07:53 PM
Some of the pages that the menu points to are in other areas. Seems that when its in the main site finds the permission for all of them but when it's in a page in one of the areas, it doesn't go thru the pages in the other areas to authenticate. Any ideas?
0
Georgi Krustev
Telerik team
answered on 06 Jun 2012, 02:58 PM
Hello Aleksander,

 
I am not sure where could be the problem. I will need a simple test project, which replicates the issue. Thus I will be able to observe the issue locally and advice you further.

Regards,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Aleksander
Top achievements
Rank 1
answered on 06 Jun 2012, 08:19 PM
here is a sample project with security not working.

Updated the code showing it's not working when going to another area.
0
Georgi Krustev
Telerik team
answered on 11 Jun 2012, 07:50 AM
Hello Aleksander,

 
Thank you for the test projects. Unfortunately I was not able to see where you are using the Menu for ASP.NET MVC. Also I noticed that the action methods of the Home controller are not decorated with any authorization attributes. Let me know if I am missing something.

All the best,
Georgi Krustev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Aleksander
Top achievements
Rank 1
answered on 18 Jun 2012, 04:32 PM
I apologize, here is the correct zip file.
0
Georgi Krustev
Telerik team
answered on 22 Jun 2012, 07:38 AM
Hello Aleksander,

 
Thank you for the test project. It seams that the issue is related with the AuthorizationContext, which we generate when call the attribute's onAuthorization method. After further investigation, I believe that we was able to address the problem.  I will suggest you try the next internal build of Telerik Extensions for ASP.NET MVC. I also updated your Telerik points for the bug report.

All the best,
Georgi Krustev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Menu
Asked by
Aleksander
Top achievements
Rank 1
Answers by
Aleksander
Top achievements
Rank 1
Georgi Krustev
Telerik team
Share this question
or