To hide control panel menu from the dock for the customer user group

use this below code in dock.vm file


#set ($userGroupLocalService = $serviceLocator.findService("com.liferay.portal.service.UserGroupLocalService"))
#set ($userGroupLst = $userGroupLocalService.getUserUserGroups($user_id))
#set($flag=0)

Replace the original code with customise code

Original Code(Liferay default code)


#if ($show_control_panel)
<li>
<a href="$control_panel_url">$control_panel_text</a>
</li>
#end

Customised Code


#foreach($userGroup in $userGroupLst )
#if("Customers" == $userGroup.getName().trim())
#set($flag=1)
#if (!$show_control_panel)
<li>
<a href="$control_panel_url">$control_panel_text</a>
</li>
#end

#end
#end
#if($flag==0)
#if ($show_control_panel)
<li>
<a href="$control_panel_url">$control_panel_text</a>
</li>
#end
#end


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: