Axapta User Permission
axapta, dynamics-ax-2009, user-permissions
Solution
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"));
Problem
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