2
votes

In Sitecore admin portal I created an user with following roles

enter image description here

When I open a Sitecore item and try to edit using Content Editor it first asks me to lock the item before making any edits. When I select "Lock and Edit" option then it says

If you publish now, the selected version will not be visible on the Web site because it has been replaced by an older version.

When I try to do the same thing using a Sitecore administrator account it doesn't ask me to lock it and the editing works fine. Is there a problem with Sitecore roles for this user?

There is something happening other than this, when I select Lock and Edit option it will create a new version instead of editing the same version. For administrator users that doesn't happen. So I think creating a new version is the main reason for this.

2

2 Answers

2
votes

Nope, this is the expected behavior. Only real administrators (where "User is administrator" is checked in the General tab on your screenshot) are able to bypass these security mechanisms.

2
votes

Using Reflector I checked where scEditorWarningTitle (scEditorWarningTitle being the class of the title of the warning message) is being used. I found out that that's in the Sitecore.Client.dll, specifically in Sitecore.Shell.Applications.ContentMnaager.Editor.RenderWarning. That namespace also has a GetWarnings method, which ciks off the getContentEditorWarnings pipeline:

using (new LongRunningOperationWatcher(Settings.Profiling.RenderFieldThreshold, "GetContentEditorWarningsArgs pipeline", new string[0]))
{
    CorePipeline.Run("getContentEditorWarnings", args);
}

Looking at that pipeline, we can see that it does the following (by default, at least in Sitecore 6.5 update 5 - this might be different in other versions of Sitecore):

<getContentEditorWarnings>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.ItemNotFound, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.CanReadLanguage, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.HasNoVersions, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.CanWrite, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.CanWriteWorkflow, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.CanWriteLanguage, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.IsReadOnly, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.IsLocked, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.HasNoFields, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.NeverPublish, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.ItemPublishingRestricted, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.VersionPublishingRestricted, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.ShowingInputBoxes, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.FeedIsEmpty, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.RunRules, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.GetContentEditorWarnings.Notifications, Sitecore.Kernel"/>
</getContentEditorWarnings>

Again in Sitecore 6.5 update 5 the only VersionPublishingRestricted warnings I see are:

If you publish now, the selected version will not be visible on the Web site because it is not in the final workflow step
If you publish now, the selected version will not be visible on the Web site because today does not fall within its valid date range
If you publish now, the selected version will not be visible on the Web site because it has been replaced by a newer version
If you publish now, the selected version will not be visible on the Web site

With the possibility of a description of either

Version X will be published instead

or

No other version will be published

All other processors I checked that are in the pipeline have no mention of being replaced by an older version either.
If the older isn't a typo, it'd be worth either looking into the getContentEditorWarnings pipeline or check your rules (which are located in /sitecore/system/Settings/Rules/Content Editor Warnings/Rules)

Edit
Right, as @horseman says, in Sitecore 6.6 this is in the VersionPublishingRestrictions:

 if ((validVersion != null) && (item.Version.Number < validVersion.Version.Number))
 {
     warning.Title = Translate.Text("If you publish now, the selected version will not be visible on the Web site because it has been replaced by a newer version.");
 }
 else if ((validVersion != null) && (item.Version.Number > validVersion.Version.Number))
 {
     warning.Title = Translate.Text("If you publish now, the selected version will not be visible on the Web site because it has been replaced by an older version.");
 }
 else if (IsInWorkflow(item))
 {
     warning.Title = Translate.Text("If you publish now, the selected version will not be visible on the Web site because it is not in the final workflow step.");
 }
 else if ((item.Publishing.ValidFrom > now) || (item.Publishing.ValidTo <= now))
 {
     warning.Title = Translate.Text("If you publish now, the selected version will not be visible on the Web site because today does not fall within its valid date range.");
 }
 else
 {
     warning.Title = Translate.Text("If you publish now, the selected version will not be visible on the Web site.");
 }

So, if there's a valid version, and the valid version number is smaller than the currently selected item's version number you'll get the message:

If you publish now, the selected version will not be visible on the Web site because it has been replaced by an older version.