第九章:XML文档集成安全

本文仅供AX从业者和爱好者学习交流之用,由于原文版权问题,请勿转载
默认情况下,行级权限和列级权限应用于所有的数据获取。但是,在某些情况下,忽略行级权限和列级权限是至关重要的,当转送发票时。在这种情况下,忽略产生文档的人的权限设定使客户看到与实际过账相同的数据是最基本的。下面的例子展现了如何重写默认的行为。
protected void unpackPropertyBag(AifPropertyBag
 _aifPropertyBag)
{
    AxdSendContext axdSendContext 
= AxdSendContext::create(_aifPropertyBag);
    ;
    
// Get send context properties.
    
    
this.security(axdSendContext.parmSecurity());
    
}
为防止欺骗,可以实现限制的概念。限制本质上是用来过滤是XML文档的潜在的合法接收者的终结点。一个限制的例子是,一个客户与AIF中配置的特定的终结点关联。在传送之前,框架会验证待发送XML文档中的所有约束来保证所选的终结点是合法的。
getConstraintList 得到AifConstraint 对象的列表,对象有个参数列表包含约束类型和约束ID。这可以防止欺骗。这个方法是AxdBase的抽象方法,必须由所有的继承类实现。下面是重写getConstraintList 方法的一个例子。
protected void getConstraintList(Common _curRec,
                                 AifConstraintList
 _constraintList)
{
    AifConstraint   aifConstraint 
= new
 AifConstraint();
    SalesTable      salesTable;
    ;
    
if (_curRec.TableId != tablenu(SalesTable))
    
{
         
throw error(strfm("@SYS23396",funcname()));
    }

    salesTable 
= _curRec;
    aifConstraint.parmId(salesTable.CustAccount);
    aifConstraint.parmType(AIFConstraintType::Customer);
    _constraintList.addConstraint(aifConstraint);
}
原文地址:https://www.cnblogs.com/Farseer1215/p/831106.html