【发布时间】:2014-07-19 05:35:36
【问题描述】:
我正在处理 AX2009 中的报告,该报告将显示哪些用户拥有哪些权限,我的问题是,
如果 user1 已获得发布运动日志的权限,我如何通过代码(在 x++ 中)找到?
谢谢
【问题讨论】:
标签: axapta dynamics-ax-2009 user-permissions
我正在处理 AX2009 中的报告,该报告将显示哪些用户拥有哪些权限,我的问题是,
如果 user1 已获得发布运动日志的权限,我如何通过代码(在 x++ 中)找到?
谢谢
【问题讨论】:
标签: axapta dynamics-ax-2009 user-permissions
看看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"));
【讨论】: