Fix casting issue in the role based template
The template causes a class casting exception as the hasRole function is refactored to accept authenticated user instead of the context object. This commit fixes the issue by updating the template to pass the user instead of context.
" id: '1',",
" on: {",
" success: function (context) {",
- " var isAdmin = hasRole(context, 'admin');",
- " Log.info('--------------- Has Admin ' + isAdmin);",
+ " // Extracting authenticated subject from the first step",
+ " var user = context.steps[1].subject;",
+ " // Checking if the user is assigned for the given role",
+ " var isAdmin = hasRole(user, 'ROLE-NAME-PLACEHOLDER');",
+ " Log.info(user.username + ' Has Admin Role: ' + isAdmin);",
" if (isAdmin) {",
" executeStep({id: '2'});",
" executeStep({id: '3'});",
