Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Security Role Testing - D365OF

$
0
0

I am exploring testing - both unit and scenario - specifically in regards to security role access. I have created a form with corresponding table and limited access to a specific role that I have created and assigned for a practice user. I am attempting to test access to the form under different roles (when I specify the correct role the test would pass, otherwise it would fail). In my unit test, I use the constructFromEntryPoint and isTableOperationAllowed methods from the SecurityContext class to test access to the table that is shown on my form. As shown in my screenshot, I have decorated the class with a SysTestSecurityAttribute specifying my default persona as having the necessary role (JPWClassAdmin). I expect this to run the test under the correct user context, causing the test to pass, however this does not work. 

I have fiddled with the SysTestSecurityContext class, specifically the setCurrentPersona method but have not been able to get it working.

Any tips for running tests under specific user/security contexts would be greatly appreciated. I am having the same problem running a task-recording based test on the same form, if that requires different advice.

Thank you for the help.


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>