I've written a piece of code that creates and publishes a new page. It works fine when I'm logged in with my administrators account but when I try to do this with an account that's not member of any groups it tells me that the required access level is publish. I read in the Getting Started section that you need to use DataFactory.Instance.Save(myPage,EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess); but this doesn't help.
What could be wrong?
You should be able to see in the stack trace which function that is throwing the access denied.
The code is used to create blog items under a "blog personal page". The exception is thrown when it's trying to create the tags for it. If I create a blog item without adding tags it works just fine but when writing down one or more it crashes due to the lack of publish rights.
You need to give the member's user or group publish rights.
Frederik, I've given "Everyone" publish rigths and below in that whole branch where the blogs are and it works. Are there any risks to it that I should be aware of?
Yes, everyone can post in each others blogs. I would instead give the individual user the proper access rights on only their blog. This can be done when you create their blog programmatically.
In a way you could say I've done that. The page id of there blog start page is stored and every time they post the id's are compared to see if they match.
I would still use EPiServer's built in access control system for this. That's what it's for :).
I'll take a look at it! :) Thanks!