Axapta用户权限

Ari*_*med 5 axapta dynamics-ax-2009 user-permissions

我正在研究AX2009中的一份报告,该报告将显示用户拥有哪些权限,我的问题是,

如果user1有权发布移动日志,我如何通过代码(在x ++中)找到?

谢谢

DAX*_*lic 6

看看SecurityKeySet课程.
例如,要检查用户是否有权访问菜单项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"));
Run Code Online (Sandbox Code Playgroud)