Try our conversational search powered by Generative AI!

Can't create page in code. No access.

Vote:
 

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?

#40808
Jun 17, 2010 15:47
Vote:
 

You should be able to see in the stack trace which function that is throwing the access denied.

#40814
Jun 17, 2010 17:34
Vote:
 

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.

#40824
Jun 18, 2010 7:52
Vote:
 

You need to give the member's user or group publish rights.

#40844
Jun 18, 2010 23:08
Vote:
 

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?

#40857
Jun 21, 2010 11:40
Vote:
 

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.

#40864
Jun 21, 2010 14:19
Vote:
 

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.

#40865
Jun 21, 2010 14:24
Vote:
 

I would still use EPiServer's built in access control system for this. That's what it's for :).

#40866
Jun 21, 2010 14:26
Vote:
 

I'll take a look at it! :) Thanks!

#40870
Jun 21, 2010 15:19
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.