GetItem および CheckOutItem コマンドで動作するデータ エクステンダー クラスを開発し、ビジネス固有の検証を行って、ユーザーがアイテムを変更するためのアクセス権を持っているかどうかを判断します (基本的に、ワークフローの最初の「作成者」タスクを過ぎている場合、誰もデフォルトでは、Tridion はワークフロー内の「レビュー担当者」がアイテムを編集することを許可していますが、これは私たちのビジネスでは禁止されています)。
ある時点でこれが機能したことは比較的確信していますが、現在は機能していません。何が変わったのかを調べていますが、誰かがアイデアを持っている場合はここで質問すると思いました.
アイテムを変更できない場合は、IsEditable 属性を false に設定しています。これにより、実際には [保存して閉じる] ボタンと [保存して新規作成] ボタンが無効になりますが、何らかの理由で [保存] ボタンが有効になります。なぜ違いが生じるのか、よくわかりません。(誰かが何らかの方法で保存ボタンを拡張したかどうかを調べていますが、それが行われていないことを確認しています)。他のボタンが有効になっていない場合に、[保存] ボタンが有効になる方法について何か考えはありますか?
提案をありがとう、
〜ワーナー
public override XmlTextReader ProcessResponse(XmlTextReader reader, PipelineContext context)
{
using (new Tridion.Logging.Tracer())
{
string command = context.Parameters["command"].ToString();
if (command == CHECKOUT_COMMAND || command == GETITEM_COMMAND)
{
XmlDocument xmlDoc = ExtenderUtil.GetExtenderAsXmlDocument(reader);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
nsmgr.AddNamespace("tcm", Constants.TcmNamespace);
try
{
//is this a page or component?
XmlNode thisItemNode = null;
thisItemNode = xmlDoc.SelectSingleNode("//tcm:Component", nsmgr) ?? xmlDoc.SelectSingleNode("//tcm:Page", nsmgr);
if (thisItemNode == null) return ExtenderUtil.GetExtenderAsXmlTextReader(xmlDoc);
// need to impersonate system admin in order to get workflow version of item later
Session sessionSystemAdmin = Util.SystemAdminSession;
XmlAttribute idAttribute = thisItemNode.Attributes.GetNamedItem("ID") as XmlAttribute;
//if ID attribute is null, we don't have the actual object being used (just a referenced item. so, we'll ignore it)
if (idAttribute != null)
{
string itemId = idAttribute.Value;
VersionedItem tridionObject = Util.ObtainValidTridionIdentifiableObject(sessionSystemAdmin, itemId) as VersionedItem;
//logic has been moved to separate method, just for maintainablility...
//the logic may change when workflow code is finished.
bool allowSave = IsItemValidForEdit(tridionObject, nsmgr);
if (!allowSave)
{
//not the WIP ("author") task... make item read-only
Logger.WriteVerbose("setting iseditable to false for item: " + itemId);
XmlAttribute isEditableAttribute = thisItemNode.Attributes.GetNamedItem("IsEditable") as XmlAttribute;
isEditableAttribute.Value = "false";
}
}
}
catch (Exception e)
{
Logger.WriteError("problem with get item data extender", ErrorCode.CMS_DATAEXTENDER_GETITEM_FAILURE, e);
}
return ExtenderUtil.GetExtenderAsXmlTextReader(xmlDoc);
}
else
{
return reader;
}
}
}