Skip to main content
Kofax

Kofax TotalAgility - How to restrict access to navigation menu item based on a run time setting?

Goal

A navigation menu has 2 items called HR and Finance.  I want to be able to restrict a users access to either of these menu items at runtime based on which department they are logging in with.

Steps

By default, a logged on user will see both the HR and Finance menu item

NavigationDefault.PNG

 

At design time, we are able to restrict access to navigation menu items.  I have configured by HR navigation menu to be accessed by everyone except users in the “NotAllowedHr” group

RestrictAccessHr.PNG

And I allowed everyone to access the Finance navigation menu except users in the “NotAllowedFinance” group

RestrictAccessFinance.PNG

By default the “NotAllowedFinance” and “NotAllowedHR” groups will have no members.

 

On my Logon form at design time, I have configured the below actions when we login to KTA.

LogonActions.PNG

The calls executed as follows:

-          Logon

-          If Finance department selected, add logged on user to the NotAllowedHr group via the AddWorkerGroupResourceMember() method

-          If Hr department selected, add logged on user to the NotAllowedFinance group via the AddWorkerGroupResourceMember() method

-          Redirect to default form

 

Logon logic would need to be extended to remove the users from any groups they already belong to.

What's Next

At runtime, I login and select the Hr department

LogonAsHr.PNG

This results in only the HR navigation menu being shown at runtime.  The finance menu is not shown as the user is a member of the NotAllowedFinance group.  This group is restricted from viewing the finance menu

NavigationAfterLogon.PNG