Configure permissions for the site administrator role in Life ray?

I want to configure permissions for the site administrator role, that is, I need to enable the function to create users to administer the site on the corresponding site. How can i achieve this? Do I need to do this with Hook OR or create EXT? OR any other easier way to achieve this? I need to enable user creation and assign permission for the Site Administrator on the corresponding site. I do not want to sort users using Super admin.

+3
source share
2 answers

Perhaps you can create your own portlet, put it in the control panel, in which only site administrators, filling out the form, can create users that you assign directly as members of the current site.

PRO: I think you can complete your task.

CON:

  • You need to spend time developing, this is not a “solution in a few clicks”.
  • This is not a permission setting.

References: “Getting Started Developing Liferay” This is a useful guide that explains, using all of Liferay's best practices, how to develop a complete portlet, the “famed” KnowledgeBasePortlet . I suggest you read everything, but the important points for your problem are:

  • Setting permissions to allow only the Site Administrator to create Users
  • Adding a portlet to the control panel

NB: As you will see ( Creating Entity Objects ), the KnowledgeBasePortlet creates two custom objects, you do not need to do this: the entities that you need already exist. Use this chapter to learn how to call methods to add / edit / delete these objects, you will have to do the same, but with the User object through UserLocalServiceUtil.

+3
source

I'm not sure I understand what you need (sorry, I'm trying to assure).

If you already have different websites, and you need to create all the site users programmatically (one snapshot), you need to create a portlet (and deploy it as a control panel portlet). Your portlet should only have an interface for calling the method ... and your method just needs to

If you prefer, your portlet can expose this method to Liferay, not the UI, but using the Liferay cron job. You just need to add the declaration inside your liferay-portlet.xml, pointing to your code: see this simple guide

In other words, if you want to automatically add a user each time you create a site using the interface, you can use the hook and redefine the event of creating an entity in the database. The websites are in the Group table, so you can add the servlet.service.events.post event handler to the service event. There you can call your code: read this useful post

I hope this can be useful for you.

+3
source

Source: https://habr.com/ru/post/916153/


All Articles