Admin don’t have access to a new SecurityKey

With Ax2009, you don’t have acces to your new SecurityKey -> Run this Job.

public void MyJob_SetSecurityKey()
{
    #define.Admin('Admin')
     // preparation of an object
    SecurityKeySet  securitySet = new SecurityKeySet();
    ;

    securitySet.loadGroupRights(#Admin, #Admin);

    // Setting rights - one line for one sec key
    securitySet.access(securitykeynum(MyNewSecurityKey), AccessType::Delete);

    // finalisation
    xAccessRightsList::saveSecurityRights(securitySet.packTouched(), #Admin, #Admin);
    SysSecurity::reload(false,false,true);
}
Advertisements