Wednesday, September 11, 2019

User role based form grid field controlling

public void init()
{
    #Admin
    UserInfo                userInfo, userInfoAdmin;
    SecurityUserRole        userRole;
    SecurityRole            securityRole;

    super();
    verticalSplitter = new SysFormSplitter_X(VSplitter, GridContainer, element, 300);


    while select userRole
        where userRole.User == curUserId()
            join securityRole where securityRole.RecId == userRole.SecurityRole
    {

       if(securityRole.AotName == 'GH_Logistics_Menus' )

        {
            GOD_CashCollection_ds.object(fieldNum(GOD_CashCollection , AccountConfirmed)).allowEdit(false);
            GOD_CashCollection_ds.object(fieldNum(GOD_CashCollection , Delivered)).enabled(true);
            //info(strFmt("name01 %1", curUserId()));
        }
        else if(securityRole.AotName == 'LedgerAccountant' )
        {

            GOD_CashCollection_ds.object(fieldNum(GOD_CashCollection , Delivered)).allowEdit(false);
            GOD_CashCollection_ds.object(fieldNum(GOD_CashCollection , AccountConfirmed)).enabled(true);
            //info(strFmt("name02 %1", curUserId()));

        }
    }


}

No comments:

Post a Comment