How to using X++ code to add security checking for go to main table

AOT/SysSetupFormRun/task

// VAR Changed on 29 Jun 2011 at 17:29:22 by 7519, add security checking for go to main table
public int task(int _p1)
{
    #task
    FormDataSource formDataSource;

    int ret;

    // VAR Changed on 29 Jun 2011 at 17:29:22 by 7519, add security checking for go to main table - start
    #define.TaskMainTable(293)

    if (    _p1 == #TaskMainTable
        && !hasSecuritykeyAccess(securitykeynum(THK_GoToMainTable), AccessType::Delete))
    {
        Box::stop("@SYS81158""@SYS72189");
        return 0;
    }
    // VAR Changed on 29 Jun 2011 at 17:29:22 by 7519, add security checking for go to main table - end

    if (_p1 == #taskFilter)
    {
        formDataSource = this.objectSet();
        if (formDataSource &&
            formDataSource.queryRun() &&
            formDataSource.queryRun().args() &&
            !formDataSource.queryRun().args().caller())
        {
            formDataSource.queryRun().args().caller(this);
        }
    }

    ret = super(_p1);

    return ret;
}
原文地址:https://www.cnblogs.com/Fandyx/p/2429824.html