How to customize which portlets to show in "Add more portlets" menu
Asked Answered
F

3

6

I need to customize as to which portlet appear in the "Add more portlet menu" as shown in the image below:

enter image description here

I need to restrict the number of portlets displayed in this menu based on the logged-in user or site (community). So that Site-owner or Site-admin will be able to add only those portlets to their pages which the omni-admin decides for them.

Does Liferay provide any such functionality (through configuration or something) or do I have to create a new portlet and a hook to achieve this?

Environment: Liferay 6.1 CE GA2

Any idea would be very much appreciated.

Thank You

Frye answered 19/5, 2012 at 10:18 Comment(0)
F
6

The following is an answer given to the same question in the Liferay forum:

You can limit what portlets can be added to the page from the Administration side and don't have to do any development.

You will need to create a role however and add everyone on it. Here are the steps for achieving this:

  1. Have the user be part of the organization or site that you want them to add portlets to.
  2. Go to Control Panel -> Rolesand make a Regular Role (not an Organization or Site role)
  3. In Define Permissions drop-down menu go to Portal -> Site -> Page -> and check Update as a defined permission.
  4. Go to Define-permissions drop-down menu again and go to Site Application -> (choose Portlet Name that you want your user add to the page) -> Add to page.
  5. Repeat Step-4, if necessary if there are other portlets you want the users to add.
  6. Add this role to your user: Go to Control Panel -> User and Organizations. Click on your User and go to Roles.
  7. Finally you need to go to Server Administration and execute the Clean Up Permissions to clear permissions for the Guest and Power Users roles.

This should now make it so that whatever user is attached to this role they will see an "Add" button on the left hand corner and will only be able to add portlets you specify in the role permissions.

Frye answered 24/9, 2012 at 11:29 Comment(3)
You could also create a new User Group and assign the new Role to the group. This way all Users belonging to that User Group will inherit the role by default.Haberdashery
@Prakash - can the same be done using code, creating the role can be done using code can we perform steps 3,4 using java code?Reinaldo
@Reinaldo Yes it can be done programmatically after all that is what is happening after you click submit :)Frye
C
0

You need to grant the ADD_TO_PAGE permission for the portlets that you want to allow. By default, Community Administrators have quite broad permissions for all portlets. Check the "Community Administrator" Role in "Define Permissions" (Control Panel/Roles/Community Administrator/Action/Define Permissions).

I suggest to see what a community administrator is allowed to do and create a custom role, define its permissions and make your "limited" admins member of this role instead of the default Community Administrator.

Conservatory answered 20/5, 2012 at 9:29 Comment(2)
I didn't knew ADD_TO_PAGE is used for this, will try it. also site (community) Administrator or site owner does not have "define permissions" action. ThanksFrye
@Olaf Kock, I need one suggestion for query which I have posted in the following link, #28813744. Please give some suggestion, so that the site administrator can access control panel for creating users..Fpc
E
0

there is beter way . all portlets permissions is checked in its permission table. go to portlet manager and first un check all for "user"

so its not shown "Add more portlet menu"

Escalera answered 4/4, 2013 at 10:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.