Blog Permissions Issue
I've recently been added to a project for our team where we are redesigning the site as well as upgrading our version of Sitefinity from 6.2 to 8.1.
Our site currently has a widget that is a entry form, however when the form is submitted, the information is entered into an unpublished Blog entry using the Sitefinity API.
When trying to get this widget to work with 8.1, I started to receive this error: "You are not authorized to 'Modify blog and manage posts' ('BlogPost')." It happens with this line of code:
blogsManager.SaveChanges();
I asked the developer of the widget about this and he said that this line should work (it works for the 6.2 version, not 8.1):
App.WorkWith().BlogPosts().GetManager().Provider.SuppressSecurityChecks = true;
Any ideas?
Thank you,
Andrew
Hi Andrew,
You can try to use the native API. Testing the following code sample on a published and unpublished posts seems works fine with unauthenticated user:
var blogManager = BlogsManager.GetManager();
blogManager.Provider.SuppressSecurityChecks =
true
;
var posts = blogManager.GetBlogPosts();
foreach
(var post
in
posts)
post.Title +=
" - New"
;
blogManager.SaveChanges();
blogManager.Provider.SuppressSecurityChecks =
false
;
Svetoslav,
This works perfectly. Thank you for your assistance!
Andrew