Sitecore では、管理者権限を持たないすべてのユーザー (ユーザーの作成時に管理者のチェックボックスがクリックされていない) は、アイテムを編集しようとすると、編集ではなく新しいバージョンを作成する [ロックして編集] オプションを選択する必要があります。既存のもの。新しいバージョンを作成せずに、管理者以外のユーザーにアイテムを編集させる方法はありますか? これがユーザーロールを使用して実行できるかどうかを期待しています。
3 に答える
Sitecore アイテムの編集中に新しいバージョンを作成するコードは次のとおりです。
public Item StartEditing(Item item)
{
Error.AssertObject((object) item, "item");
if (!Settings.RequireLockBeforeEditing || Context.User.IsAdministrator)
return item;
if (this._context.IsAdministrator || StandardValuesManager.IsStandardValuesHolder(item) || !this.HasWorkflow(item) && !this.HasDefaultWorkflow(item) || !this.IsApproved(item))
return this.Lock(item);
Item obj = item.Versions.AddVersion();
if (obj != null)
return this.Lock(obj);
else
return (Item) null;
}
ユーザーが管理者でない限り、アイテムがワークフローの最終状態にある場合、Sitecore は新しいバージョンを作成するようです。
設定を変更することもできRequireLockBeforeEditing
ますが、新しいバージョンの機能だけでなく、ロック機能も無効になります。
これを無効にするには、web.config でこのオプションを編集します ->
<setting name="RequireLockBeforeEditing" value="true"/>
詳しくはこちら
幸運を!
これは、Sitecore のロックのデフォルトの動作です。
Sitecore はアイテム ロックを使用して、2 人の異なるユーザーが同じアイテムを同時に編集できないようにします。2 人以上のユーザーが何らかの方法で同じアイテムを同時に編集した場合、最後に [保存] をクリックしたユーザーが行った変更のみが利用可能になります。他のすべての変更は失われます。アイテムのロックは、編集中のアイテムをロックし、アイテムの編集が完了した後に再びロックを解除するまで、他のユーザーがこのアイテムを編集できないようにするシステムです。アイテムのロックは、使用しているツールによって異なります。ページ エディターでは、編集を開始する前に項目をロックできます。コンテンツ エディターでは、編集する前に項目をロックする必要があります。
ロックの詳細については、こちらをご覧ください
web.config からこの設定も見てください。
<!--
REQUIRE LOCK BEFORE EDITING
If true, the user must have a lock on a document before
he can edit it, otherwise it is always ready for editing
-->
<setting name="RequireLockBeforeEditing" value="true"/>
<!--
KEEP LOCK AFTER SAVE FOR ADMIN USERS
Set this value to true if you want to Administrator users to keep the lock on an item after saving
it in the Page Editor.
Notice: For regular users, the "Keep Lock After Save" item in the core database will determine whether
to keep the lock or not.
Default value: false
-->
<setting name="KeepLockAfterSaveForAdminUsers" value="false"/>
<!--
AUTOMATIC LOCK ON SAVE
If true, the a lock is automatically taken on an item
when a user saves the item.
-->
<setting name="AutomaticLockOnSave" value="false"/>
<!--
AUTOMATIC UNLOCK ON SAVED
If true, the a saved item is automatically unlocked after
saving.
-->
<setting name="AutomaticUnlockOnSaved" value="false"/>