Im working on a report in AX2009 that will show what users have what permission, my question is,
how can i find through code (in x++) if user1 has got permission to post movement journals ?
thanks
Have a look at the SecurityKeySet
class.
For example, to check whether the user has access to the menu item InventJournalPost
:
SecurityKeySet userRights;
MenuFunction inventJournalPostFunction;
AccessType functionAccess;
boolean canPost;
;
userRights = new SecurityKeySet();
userRights.loadUserRights(curuserid()); // or any other user ID
inventJournalPostFunction = new MenuFunction(
menuitemactionstr(InventJournalPost),
MenuItemType::Action);
functionAccess = userRights.menuItemAccess(
inventJournalPostFunction.name(),
AccessRecordType::MenuItemAction);
canPost = (functionAccess >= inventJournalPostFunction.neededAccessLevel());
info(strfmt("User %1 post inventory journals", canPost ? "can" : "can not"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With