Telerik.Sitefinity.Model was not granted View in Pages for principals with IDs 00000000
Hi, actually i use a radRotator control in the home page, and when i'm using hyperlinks this error appeare.
Hello Luis Enrique,
Can you please make sure that you are querying the pages for the front end only? It looks that you are trying to query for all pages and the API call is failing due to insufficient permissions (seems like an anonymous user).
Best wishes,
Radoslav Georgiev
the Telerik team
I'm getting exactely the same error. I opened a support ticket and heres the answer I got from Ivan.
"You have a custom control that works with pages - NewsRotator.ascx.cs. In this control you are using the API to get the pages, but the anonymous user does not have view permission on some of the pages and this results in an error. Generally you query all pages, so you need to grant view to the anonymous user for all pages."
Sounds great but theres not instructions on how to set these permissions. Ive tried going to the Administration menu in sitefinity and setting Global Permissions and added the Anonymous user to have 'view permissions' however this still does not work.
How do I get front pages only to avoid this permission issue?
Hi Bruno,
For me it was the lambada expression that needed to be referencing the front end.
The highlighted text is the additional expression that resolved my issue.
this
.targetNewsPage = App.Prepare(settings).WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
.Where(p => p.Page !=
null
&&
p.Page.Controls.Where(c => c.ObjectType.StartsWith(
typeof
(NewsView).FullName)).Count() > 0)
.Get().FirstOrDefault();
This works. Thanks..
Would this work if some of your front end pages where restricted by role/group?
Hello,
Yes, it should work. Depending on your specific project settings the query will automatically exclude the pages that the current user does not have view permissions for.
By default Sitefinity has the view permissions check disabled, as this brings additional performance benefit when querying each item.
However you can achieve the desired functionality by enabling the FilterQueriesByViewPermissions parameter in our Security configuration, by going to Administration ->Settings -> Advanced -> Security.
When this filter is enabled, by default all API calls, like the one you have given as an example, will be filtered, and the returned results of the query will be only the ones that the current user has the permissions to view.
For more information about the FilterQueriesByViewPermissions setting you can also check this KB article form our Knowledge base, hope you find it useful
Regards,
Boyan Barnev
Telerik