HistoricalAX 2009
AX 2009: check a security key from X++
Check from X++ whether the current user has full access to a security key in AX 2009, with SecurityKeySet.
Security keys belong to the AX 2009 security model; finance and operations apps use role-based security.
- First written
- Re-read
- Versions
- AX 2009
In AX 2009 access was granted through security keys. This short job checks whether the current user has full (delete) access to a given key. Finance and operations apps grant access through security roles, duties and privileges instead (Role-based security).
The original note
With this script you can check from code whether a user has permission on a particular security key.
SecurityKeySet securityKeys;
Boolean fullAccess;
;
securityKeys = new SecurityKeySet();
securityKeys.loadUserRights(curuserid());
fullAccess = securityKeys.access(securitykeynum("xxxxxxxxxxxxxxx")) == AccessType::Delete;
info(fullAccess ? "1" : "0");
References
- Role-based security (Microsoft Learn)