I would like to identify that the logged in user is an administrator or not using velocity. The goal is to show the dockbar to the administrator user(s) only.
I have tried following code, but is not working for me:
#if ($is_signed_in && $permissionChecker.isGroupAdmin($group_id))
#dockbar()
#end
Please help me!!!
Depending on the requirement, there are following two ways to check whether the logged in user is an admin user or not:
Show dockbar to all the admin users:
#if ($is_signed_in && $permissionChecker.isOmniadmin())
#dockbar()
#end
Show dockbar to specific admin user(s) based on role-name:
#set($showDockBar = false)
#foreach($role in $$themeDisplay.getUser().getRoles())
#if ($role.Name == 'Administrator' || $role.Name == 'Web Administrator')
#set($showDockBar = true)
#end
#end
#if ($is_signed_in && $showDockBar)
#dockbar()
#end