Gurpreet Singh
Gurpreet Singh

Reputation: 1

How do I make ( Users and Organizations ) as a portlet in liferay 7.3.6

I'm trying to use "Users and Organizations" as a portlet.

I have tried as mentioned in this outdated (6.x) article but it doesn't work.

Upvotes: 0

Views: 262

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48057

This can be done without any code at all, but you'll need quite a bit of configuration.

The portlet is an OSGi component. First, figure out the implementation class. The URL gives a hint, as it contains com_liferay_users_admin_web_portlet_UsersAdminPortlet. However, in this case, that's just the key. Grep the sourcode, or use any other means to find where it's used, and you'll get to com.liferay.users.admin.web.internal.portlet.UsersAdminPortlet. If you look at its properties configuration, you'll find the line

"com.liferay.portlet.display-category=category.hidden",

If you guess that this is the reason why the portlet is not available for just any page: you're right.

Now, any OSGi declarative service's properties can be altered by just creating a config file, which you can drop into Liferay's deploy folder (or directly into osgi/configs if you like).

So, create a file named com.liferay.users.admin.web.internal.portlet.UsersAdminPortlet.config with the single line content

com.liferay.portlet.display-category="category.sample"

and you're set.

However, regular permission checks likely are very restrictive and you should be very aware that opening up those permissions can easily open security holes (imagine someone creating a full Administrator account, or turning an existing account into an administrative one)

A better way to go ahead might be to selectively just provide the proper permissions to operate this portlet, and provide access to it in ControlPanel without opening everything else up as well. This is part of the regular roles&permissions configuration, and also doesn't require any line of code.

Upvotes: 1

Related Questions