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.
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.
Copyright © 2021 Jogjafile Inc.
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 tocom.liferay.users.admin.web.internal.portlet.UsersAdminPortlet. If you look at its properties configuration, you'll find the lineIf 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.configwith the single line contentand 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.