Thursday, August 11, 2016

Get All AOT Security Duty/Privilege by AOT menu Item Ax 2012

// Get All AOT Security Duty/Privilege by AOT menu Item Ax 2012

static void GetPrivilegeDuitesbyMenuItem(Args _args)
{
    SecurityTask    st;
    SecurityTaskEntryPoint   stentry;
    SecurableObject     so;
    SecurityTask             stduty;
    SecuritySubTask       sstduty;
    ;
    while select * from stentry
            join  so
                where so.RecId == stentry.EntryPoint
                    &&  so.Name == menuitemdisplayStr(ledgerJournalTable)
    {
        while select * from st
            where st.RecId == stentry.SecurityTask
        {
            info(strFmt("%1,%2,%3", st.AOTNAME,st.Type,stentry.PermissionGroup));          

            select firstOnly RecId from stduty
                        where stduty.AotName =="InventDimParmFixedMaintain"
                        && stduty.Type == SecurityTaskType::Privilege;

            while select SecurityTask from sstduty
                    where sstduty.SecuritySubTask == stduty.RecId
            {
                select firstOnly * from stduty
                        where stduty.RecId == sstduty.SecurityTask;
                info(strFmt("%1,%2", stduty.AOTNAME,stduty.Type));
            }
        }
    }
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...