Wednesday, June 11, 2008

Data Authorization in axapta through coding

Data authorization in Microsoft Dynamics AX is performed in three ways:
1.Implicit Authorization
Implicit authorization means that the kernel performs the check. An example of this would be when you are accessing a data source from a form or report. Record level security is used to determine whether the user has access to run the form or report.
2.Checks Done by Setting Security Properties on AOT Objects
An example of this is setting the security key and needed access level properties on menu items and on form or report controls.
3.Checks done in X++
Examples:
if (hasSecurityKeyAccess(securitykeyNum(mySecurityKey), AccessType::View))
{
myMethod();
}

if (hasMenuItemAccess(menuItemDisplayStr(myMenuItem), MenuItemType::Display)))
{
myMethod();
}

DictTable dictTable = new DictTable(tablenum(myTable));
if (dictTable.rights >= AccessType::Insert))
{
myMethod();
}

if (isConfigurationkeyEnabled(configurationkeyNum(myConfigurationKey))
{
myMethod();
}

No comments: