View Permissions not working properly.

Aug 23, 2012 at 9:54 AM

Hi, I have deployed the solution on Sharepoint 2010 server. But some how View permissions are not working as expected. I can restrict view for some users. But all the views are still visible in menucontrol. However if user clicked on restricted view he gets unauthorised access error which is fine.

Also while setting view permission on settings page i can only view last view created (only one view). I cant setup permissions for all the views.

Regards,

Ujjwal

Coordinator
Aug 23, 2012 at 9:10 PM

Hello. I will again check this why:
1. You can only see last view
2. You can still see views in Menu

I have tested this solution on three SharePoint servers and everything was working but I try to do my best to solve this.

Thanks for bugs

Coordinator
Aug 23, 2012 at 9:16 PM

Hello. Thank you for information I have one question...Please are you able to go to

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE   (or where is your SharePoint installed)

and there is file vsmenu.aspx.... Please open this file in some textpad (Don't change anything) and try to find this:

<SPGuysCustomFieldPermissionLibrary:CustomViewSelectorMenu

If you don't have this text in your file I think that I am able to solve this problem... But if you have this text in your file....I am not sure what can be a problem...
Please if you can check this on your sharepoint.

Thank you

Aug 30, 2012 at 1:36 PM

I checked for <SPGuysCustomFieldPermissionLibrary:CustomViewSelectorMenu in vsmenu.aspx. This line was there but still i am facing the same issue. Did you manage to reproduce same bug in you environment? I am using Sharepoint 2010 Standard.

Aug 31, 2012 at 9:18 AM

I managed to track down one issue i.e. i can only see last view instead of all the view in view permissions page. When i debug the code i found that on ListView.aspx.cs before rendering the page you are checking below condition.

 if (currentView.Title != "" && currentView.BaseViewID == "1")

and thats why it is rendering just last view.

When i changed the code to if (currentView.Title != "") , now i can see all the views and set permissions to all the views.

Is there any specific reason for checking this condition currentView.BaseViewID == "1".

However i am not able to resolve 2nd issue. Still i can see all the views in view selector.

Thanks.

Coordinator
Aug 31, 2012 at 4:32 PM

Hello.
    Thank you very much. In new version is this currentView.BaseViewID == "1" removed. This was made because document libraries displayed views which were not available for users. I have removed this and right now you can see all views. I have created new system for vsmenu.aspx so Please uninstall the solution and install new version of my solution and please let me know. For me is this again working without any problem. Thank you

Sep 2, 2012 at 5:37 PM

I checked your new version. But both the issues are still there. This time i tried on different Sharepoint 2010 installation but still i am facing both the issues. I also tried on Tasks list, calendar list, document lib. but still i can see all the views in view menu list and view setting page i can only see last view not all the views.

Coordinator
Sep 2, 2012 at 6:09 PM
Hmm...Are you sure You have downloaded the new version and before installation you have uninstalled the previous version? I have removed the problem with BaseViewId = 1 and this is for 100% not there. But I will check it again and let you know. Thank you
From: [email removed]
Sent: Sunday, September 02, 2012 7:37 PM
To: [email removed]
Subject: Re: View Permissions not working properly. [SPColumnPermission:392776]

From: ujjwalpa

I checked your new version. But both the issues are still there. This time i tried on different Sharepoint 2010 installation but still i am facing both the issues. I also tried on Tasks list, calendar list, document lib. but still i can see all the views in view menu list and view setting page i can only see last view not all the views.

Sep 2, 2012 at 7:02 PM

Yes i have removed the previous version and even reset the iis just to make sure. I will download the code and rebuild the solution @my end and again will install it and let you know. Is there any one else also facing the same issue or just i am getting these weird things.

Coordinator
Sep 2, 2012 at 7:22 PM
Hello. One person has also the problem that he can see all views in menu. I am not able to simulate this...In this version is in httpmodule and vsmenu.aspx is not called but my own SPGuys_menu.aspx and there is my custom code so I don’t know why you can still see all viewsSmútok. Without debugging I think that I not able to solve this. But I will try this. Thanks you for report.
From: [email removed]
Sent: Sunday, September 02, 2012 9:02 PM
To: [email removed]
Subject: Re: View Permissions not working properly. [SPColumnPermission:392776]

From: ujjwalpa

Yes i have removed the previous version and even reset the iis just to make sure. I will download the code and rebuild the solution @my end and again will install it and let you know. Is there any one else also facing the same issue or just i am getting these weird things.

Sep 2, 2012 at 7:26 PM

In the last version of your code httpmodule never gets called on my machine somehow. I will try to debug with new code. Do you think httpmodule is causing this issue?

Coordinator
Sep 2, 2012 at 7:54 PM
Hmm...difficult to say Tomorrow I try to prepare some documentation for you and you can test the solution by debugging it and we will try to find why the menu is not working. Thank you
From: [email removed]
Sent: Sunday, September 02, 2012 9:26 PM
To: [email removed]
Subject: Re: View Permissions not working properly. [SPColumnPermission:392776]

From: ujjwalpa

In the last version of your code httpmodule never gets called on my machine somehow. I will try to debug with new code. Do you think httpmodule is causing this issue?

Sep 3, 2012 at 8:27 AM

I have downloaded your code uploaded on 31Aug and found that ( if (currentView.Title != "" && currentView.BaseViewID =="1")) this line is still there and thats why i am not able to see all the views on view settings page. Can you please send me your local copy of code or upload the latest code on codeplex.

Regards,

Sep 3, 2012 at 9:31 AM

Hi,

Currently i am debugging the code and slowly understanding the logic as well. One interesting thing i noticed is in RedirectModule when you redirect from "vsmenu.aspx" to "/_layouts/SPGuys_menu.aspx" it does changes the Request.Url.AbsolutePath but i dont think that is redirecting it actually. Because if it is redirecting then code from CustomViewSelectorMenu should fire because SPGuys_menu.aspx contains this control. But this is not happening and my guess is thats why it is not hiding the restricted views.

I dont know whether it helps you in solving the issue though :)

Regards,

Coordinator
Sep 3, 2012 at 11:10 AM
Hello. Yes yes you are right. If you have Firefox Web browser and firebug plugin installed you can see when you click on this menu if you are redirecting to SPGuys_menu.aspx. If you are redirecting to my code and you can still see full menu I don’t know why this happen. I think that redirecting works but there can be some problem that my control is not called....Hmm...Hard to say what can be a problem because for me this is working .... without any problem...I love SharePoint but I hate it....Give me a week and I try to find the solution for this. Thank you very much for your help.
From: [email removed]
Sent: Monday, September 03, 2012 11:31 AM
To: [email removed]
Subject: Re: View Permissions not working properly. [SPColumnPermission:392776]

From: ujjwalpa

Hi,

Currently i am debugging the code and slowly understanding the logic as well. One interesting thing i noticed is in RedirectModule when you redirect from "vsmenu.aspx" to "/_layouts/SPGuys_menu.aspx" it does changes the Request.Url.AbsolutePath but i dont think that is redirecting it actually. Because if it is redirecting then code from CustomViewSelectorMenu should fire because SPGuys_menu.aspx contains this control. But this is not happening and my guess is thats why it is not hiding the restricted views.

I dont know whether it helps you in solving the issue though :)

Regards,

Sep 7, 2012 at 1:27 PM

Hi,

I checked this one in firebug and page gets redirected from vsmenu.aspx to SPGuys_menu.aspx but still i can see all the view. its really annoying.

Coordinator
Sep 7, 2012 at 6:29 PM
Hello. I am sorry but this is a free feature and I am working on this only in my free time. There is a problem the method AddMenuItems is not called in your SharePoint. Right now I don’t know how to solve this and why this override method is not called. I try to look on this at weekend. Thank You
From: [email removed]
Sent: Friday, September 07, 2012 3:27 PM
To: [email removed]
Subject: Re: View Permissions not working properly. [SPColumnPermission:392776]

From: ujjwalpa

Hi,

I checked this one in firebug and page gets redirected from vsmenu.aspx to SPGuys_menu.aspx but still i can see all the view. its really annoying.

Coordinator
Sep 8, 2012 at 7:22 PM

Hello. I have created new version where is removed method AddMenuItems and everything is in OnInit method. Again for me this is working so please:
1. Uninstall old version of this feature
2. Restart IIS
3. Install and Activate new version 1.3
4. Restart IIS and WebBrowser
5. Test it.

If this version still not work correctly I don't know what can be a problem and I am unable to resolve this problem without debuging. I have tested this feature on 5 enviroments for now and everything was working.

PS: Please what type of Site Collection do you use on your Web Application?

Sep 8, 2012 at 7:53 PM

Thanks for looking into this bug. I will test this new solution and let you know. I am using Team Site as my site collection. Even i tried to debug this issue but not able to identify why code is not firing if page is getting redirected to SPGuys_menu.aspx. Anyways i have installed 2 more environments of SP 2010, i will test on those one as well.

Coordinator
Sep 8, 2012 at 8:25 PM
Thank you very much. Tomorrow I will create Team site collection. Maybe there is some problem if some feature from SharePoint is activated because I am testing this on blank site collection without any special feature. Thank you
From: [email removed]
Sent: Saturday, September 08, 2012 9:53 PM
To: [email removed]
Subject: Re: View Permissions not working properly. [SPColumnPermission:392776]

From: ujjwalpa

Thanks for looking into this bug. I will test this new solution and let you know. I am using Team Site as my site collection. Even i tried to debug this issue but not able to identify why code is not firing if page is getting redirected to SPGuys_menu.aspx. Anyways i have installed 2 more environments of SP 2010, i will test on those one as well.

Sep 11, 2012 at 3:54 PM

Not working. In the new version RedirectModule never gets called, it was in the last version.

Coordinator
Sep 11, 2012 at 4:26 PM
Hello. I am still looking on it. I found that if your you create blank site collection this is working but if you create Team site site collection doesn’t. I am think that some standard feature which is enabled on Team site block my code....Hmm...I try to find why. Thank you very much.
From: [email removed]
Sent: Tuesday, September 11, 2012 5:54 PM
To: [email removed]
Subject: Re: View Permissions not working properly. [SPColumnPermission:392776]

From: ujjwalpa

Not working. In the new version RedirectModule never gets called, it was in the last version.

Sep 12, 2012 at 2:23 PM
Edited Sep 14, 2012 at 7:45 AM

Yes i manage to run 1.2 version on blank site. It is working as expected. but somehow the new version is not working even on blank site. I think for now i have to go with blank site only. Thanks a lot for your solution.

Sep 14, 2012 at 10:35 AM

One more issue i found that redirect module not working on lists under the subsites. Solutions is as follows -

In RedirectModule instead of

              if (page.Request.Url.AbsolutePath.Contains("vsmenu.aspx"))
                    {
                        page.Response.Redirect("/_layouts/SPGuys_menu.aspx" + page.Request.Url.Query, true);
                    }

If we use below code

              if (page.Request.Url.AbsolutePath.Contains("vsmenu.aspx"))
                    {
                        string redirectUrl = spWeb.Url.ToString() + "/_layouts/SPGuys_menu.aspx" + page.Request.Url.Query;
                        page.Response.Redirect(redirectUrl, true);
                    }

this will work on subsites as well.

Just thought of letting you know :)

Coordinator
Sep 14, 2012 at 11:09 AM
Hello. Thank you very much for this code I will check this and in new version I will add your code....Version 1.2 is working with redirect module version 1.3 not because I was still looking for some solution for the menu....Smútok So in next version I will use your code and try to find why for team site the menu is not working..... Again Thank you very much....Thanks
From: [email removed]
Sent: Friday, September 14, 2012 12:35 PM
To: [email removed]
Subject: Re: View Permissions not working properly. [SPColumnPermission:392776]

From: ujjwalpa

One more issue i found that redirect module not working on lists under the subsites. Solutions is as follows -

In RedirectModule instead of

if (page.Request.Url.AbsolutePath.Contains("vsmenu.aspx"))
{
page.Response.Redirect("/_layouts/SPGuys_menu.aspx" + page.Request.Url.Query, true);
}

If we use below code

if (page.Request.Url.AbsolutePath.Contains("vsmenu.aspx"))
{
string redirectUrl = spWeb.Url.ToString() + "/_layouts/SPGuys_menu.aspx" + page.Request.Url.Query;
page.Response.Redirect(redirectUrl, true);
}

this will work on subsites as well.

Just thought of letting you know :)

Coordinator
Sep 22, 2012 at 9:50 AM

Hello.
I found the problem with views. If you have activated on your site collection Metadata Navigation and Filtering the context menu still displays all views. I am not sure why SharePoint not hit my CustomViewSelectorMenu. Hmm...Very hard to say what can be a problem because my custom aspx page is hit but customviewselector menu not....Hmm... Thanks for any help.

Sep 25, 2012 at 8:02 AM

Thanks a lot. You are right it is not working with Metadata Navigation and Filtering. Anyways this will do the job for me as i am not using this feature anyways. Its a best solution i ever found on codeplex so definitely 5 stars for you.

I am planning to extend this solution and add few features -

1. Restrict this feature to particular list rather than all the lists in the site collection.

2. Try to find the solution for this Metadata Navigation bug.

I will send you the code if i can make these changes.

Thanks a lot.

Coordinator
Sep 25, 2012 at 12:39 PM

Hello.

Thank you very much and I will be happy if you find the problem with metadata navigation and yes of course I will implement this to this feature. I am working also on other bugs like if you have a view with group by formula the permission doesn’t work for fields. There is lot of work on this but I try to find solution for everyone and I will be very happy if you help mi with this. Thank you very much.

On 25 Sep 2012 01:02:13 -0700
"ujjwalpa" wrote:
>From: ujjwalpa
>
> Thanks a lot. You are right it is not working with Metadata
>Navigation and Filtering. Anyways this will do the job for me as i am
>not using this feature anyways. Its a best solution i ever found on
>codeplex so definitely 5 stars for you. I am planning to extend this
>solution and add few features - 1. Restrict this feature to
>particular list rather than all the lists in the site collection. 2.
>Try to find the solution for this Metadata Navigation bug. I will
>send you the code if i can make these changes. Thanks a lot.
>
>

Coordinator
Oct 2, 2012 at 5:13 AM

Hello. New version 1.5 available also with soruce. This new version solve the problem with hidding fields in Views with group by formula. Thank you
PS: Have you find the solution for MetaData Navigation enabled? Thank you

Dec 11, 2013 at 6:05 PM
Hello,

Our SharePoint uses Column Permission Powered by SPGuys (SharePoint 2010). About a month ago, the Column Permission stopped working after an update was run on the server. Most notably, Column Permission will work with out-of-the-box Forms, but when I try and customize them in SharePoint Designer, Column Permissions stops working and all field become editable.

Our help desk is having issue finding the a solution so I was hoping for some advice. Has anyone run into a similar issue? What questions should I be asking our help desk?

Thanks!