4 Jun 2014

TO get a current User Id and User Role assignment through X++


// TO get a current User Id and User Role assignment through X++ in ax 2012

http://arsalanax.blogspot.in/2012/02/role-based-security-in-ax.html

static void UserRoleAssigninfo(Args _args)
{
     SecurityRole        role;
     SecurityUserRole    userRole;
     UserInfo            userInfo;
     ;

 
    select firstonly  role
    exists join userRole
    where role.RecId     == userRole.SecurityRole
          && userRole.User == curUserId();
 
    info(strFmt("%1  -  %2", role.Name,curUserId()));
 
}

1 comment: