On my current Dynamics AX project, I must add a field group in a form, and protect this group by a given security key. For people with no access to this security key, I must display a replacement text.
How can I test that the current user has the right to access the security key, so that in this case I can hide the replacement text ?
You can use the following code to find whether user has the right to access the security key:
SecurityKeySet securityKeys;
AccessType accessType;
;
securityKeys = new SecurityKeySet();
securityKeys.loadUserRights(curUserId());
accessType = securityKeys.access(securityKeyNum("YourSekurityKey"));
info(enum2str(accessType));