Pregunta

I am using an Alfresco portlet inside my Liferay website.

Whenever I create a new Liferay user, he is automatically created in Alfresco also.

However, this user has no permissions for uploading, creating folders, etc. inside my portlet. I need him to do just that because it's hard to create a user in Alfresco and then create the same user in Liferay, as seen here (http://wiki.alfresco.com/wiki/Doclib_Portlet): "The users must already have been set up with the correct permissions in Alfresco, and the 'Screen Name' of the user in Liferay must match their Alfresco username."

My approach is that I create a new ext that overrides CreateAccountAction.java called ExtCreateAccountActiont-ext. Inside the addUser(ActionRequest actionRequest, ActionResponse actionResponse) method, after the user is created (User user = UserServiceUtil.addUserWithWorkflow(parameters), I will grant him Alfresco permissions.

My question is how do I do that because I found nowhere something useful.

¿Fue útil?

Solución

I'm not sure if I understand correctly...

You'll need to figure out if you're lacking the permissions on the Liferay side (e.g. the portlet does not even provide the UI to modify Alfresco, even though in Alfresco you'd have the permission) or if it forwards correctly and Alfresco refuses to do work because something is wrong on that side.

(As you can probably tell, I've never looked at this aspect of the alfresco portlet)

You can figure this out under ControlPanel/Roles, create a new "Alfresco User" role with the scope you need, then "Define Permissions" and look for the Alfresco portlet in the list. Check what permissions it offers - these are the permissions that are evaluated on the Liferay side. You might grant all or some of the permissions for users with this role. Save.

Now assign this role to users where applicable and check if it works. You could add this role association for new users in your overridden addUser method, or you could just make it a default role for every new user (ControlPanel/Portal Settings/somewhere...)

On a related note, if you use a hook to override this service method, you'd end up with an easier-to-deploy plugin that is also easier to maintain for future versions of Liferay. Hooks can do that, are hot-deployable and preferable to ext whereever they can achieve what you need to achieve.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top