X++:
static void Test_AccessibleForWho(Args _args)
{
SecurityKeySet secSet;
UserGroupInfo userGroup;
DomainInfo domain;
str items;
container menuItems = [
[menuItemDisplayStr(UKS_IV_Load), AccessRecordType::MenuItemDisplay]
];
str accessibleMenuItems()
{
int i;
MenuItemName name;
AccessRecordType type;
str ret;
;
for (i=1; i<=conLen(menuItems); i++)
{
[name, type] = conPeek(menuItems, i);
if (secSet.menuItemAccess(name, type))
{
if (ret)
ret += ', ';
ret += SysDictMenu::newMenuItem(name,
(type == AccessRecordType::MenuItemAction) ?
MenuItemType::Action : MenuItemType::Display
).label()+strFmt(', %1', secSet.menuItemAccess(name, type));
}
}
return ret;
}
;
while select userGroup
{
while select domain
{
secSet = SysSecurity::constructSecurityKeySet();
secSet.loadGroupRights(userGroup.id, domain.Id);
items = accessibleMenuItems();
if (items)
{
info(strFmt('%1;%2: %3', userGroup.id, domain.Id, items));
}
}
}
}