Monday, February 13, 2012

Authorization Checks Code

Authorization Checks
Microsoft Dynamics AX 2009 performs automatic authorization when a user
accesses data through data sources on forms or reports. X++ code can also call
these checks in cases where automatic authorization does not occur.


if (hasSecurityKeyAccess(securitykeyNum(mySecurityKey),
AccessType::View))
{
//code requiring authorization goes here...
}
if (hasMenuItemAccess(menuItemDisplayStr(myMenuItem),
MenuItemType::Display)))
{
//code requiring authorization goes here...
}
DictTable dictTable = new DictTable(tablenum(myTable));
if (dictTable.rights >= AccessType::Insert))
{
//code requiring authorization goes here...
}
if
(isConfigurationkeyEnabled(configurationkeyNum(myConfigKey)
)
{
//code requiring authorization goes here...
}

No comments:

Post a Comment