Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Gerardo Roger
Dockbar only for Administration
April 25, 2012 3:21 AM
Answer

Gerardo Roger

Rank: New Member

Posts: 16

Join Date: March 28, 2012

Recent Posts

Hi, I was looking for ways that the dockbar only appear for users with role of administration or other option is this possible? I guess I have to set something in the portal_normal.vm in the following lines:
#if ($is_signed_in)
#dockbar()
#end
Jitendra Rajput
RE: Dockbar only for Administration
April 25, 2012 3:40 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 709

Join Date: January 7, 2011

Recent Posts

Try by using Liferay service classes in velocity file .

Something like this . Not tested but it will help you to achieve your requirement.

1#set ($roleLocalService= $serviceLocator.findService("com.liferay.portal.service.RoleLocalService"))
2#set ($isAdmin = $roleLocalService.hasUserRole($userId, $roleId))



In above code user id you can easily get from request .
1$request.get("theme-display").get("user-id"))


And to get role id again you need to access role services.
Ravi Kumar Gupta
RE: Dockbar only for Administration
April 25, 2012 3:45 AM
Answer

Ravi Kumar Gupta

Rank: Liferay Legend

Posts: 1146

Join Date: June 23, 2009

Recent Posts

Mikel Goikoetxea
RE: Dockbar only for Administration
April 25, 2012 3:48 AM
Answer

Mikel Goikoetxea

Rank: Junior Member

Posts: 56

Join Date: March 16, 2010

Recent Posts

Hi Gerardo,

Try with the $permissionChecker. For example:
1#if (($permissionChecker.isOmniadmin())||$permissionChecker.isCompanyAdmin($themeDisplay.getCompanyId())|| $permissionChecker.isCommunityAdmin($themeDisplay.getScopeGroupId()))
2    #dockbar()
3#end

Un saludo,

Mikel Goikoetxea Bilbao (@mgoibil)
B2B 2000
Gerardo Roger
RE: Dockbar only for Administration
April 25, 2012 4:08 AM
Answer

Gerardo Roger

Rank: New Member

Posts: 16

Join Date: March 28, 2012

Recent Posts

Thank you for your answers, I have solved my problem with the option you suggested Mikel.

Muchas gracias por todo Mikel, un saludo!
Puneet Upadhyay
RE: Dockbar only for Administration
April 25, 2012 5:38 AM
Answer

Puneet Upadhyay

Rank: Regular Member

Posts: 234

Join Date: October 22, 2011

Recent Posts

Hi Roger,

Its really nice one. Thanks Mike also.