Fix EZP-21797: recursive sudo usage.

JIRA: https://jira.ez.no/browse/EZP-21797

On certain conditions, PAPI will attempt to use sudo recursively (f.e. when using a legacy slot in sudo operation, as described in related JIRA).

This effectively removes the exception, implementing instead a "nesting level" counter instead (similar to transaction counter).

 function `sudoFlag()` was added, which could be private/public (API interface) instead.

Comments / feedback welcome.
Why we need the sudoFlag function? Can't we just check sudoLevel here?