Search code examples
securityaxaptax++dynamics-ax-2012

Why is the maximum depth of sub-roles 3 in Dynamics AX 2012?


Consider a custom security role that has sub-roles attached to it. Those sub-roles also have sub-roles. If they chain too many times, you will get a compiler error that says:

The role has too many levels of sub-roles. The maximum sub-role depth is 3.

Why is the maximum sub-role depth 3, and what are the consequences of not fixing the error?


Solution

  • I believe the error is because you can create circular references.

    enter image description here

    When you get to a certain depth, combined with many nodes, the math to check for circular references can get absurd and be performance heavy.

    Also, I would guess AX uses tree traversal to check security, and it would probably have a performance impact traversing tons of nodes.