Thursday 19 April 2012

I've just got in the situation where simple code like:

using (new SecurityDisabler()){
//publish item
}

didn't work.

I was so sure in fact that it should work because of my previous experience with Sitecore, that it took me some time to find the problem. And here it is: there is a setting Publishing.CheckSecurity in web.config. When it is set to true, Sitecore uses SecurityEnabler when publishes, so turning on SecurityDisabler before it makes no sense.

If you run into same question, just use UserSwitcher or disable Publishing.CheckSecurity.

No comments:

Post a Comment