Finally I was able to make the permissions system work, and sadly I have to say that the documentation refered above is WRONG! At least for liferay 6.0.5
Next I will tell you how i did it, mentioning what is wrong on the documentation:
1. Create the permission xml
I can name the file with anything. Mine was test-portlet.xml. You have to put it inside the folder resource-actions inside webapps/ROOT/WEB-INF/classes.
The format has to be this:
First error: you have to use the
Second error: the documentation says you can use the portlet name you put on the portlet.xml. You can't. You have to use the Plugin ID. You can find it on the control panel on the plugins configuration area. Just select the portlet you want to change and check for the Plugin ID.
2. Create the default-aux.xml
Again any name will do but default.xml. With this name I think liferay gets confused with the deafult xml file inside portal-impl.jar. the format is:
Third error: You have to change the portal-ext.properties file. Nobody tells you that there. You have to insert the following line:
resource.actions.configs=resource-actions/default.xml,resource-actions/default-aux.xml
With this line liferay will load permissions for the default portlets and also yours, without any need to repeat code.
3. I18n everything
I did not try not to do this move but i think usually you'll need to translate the permission actions. for that use the language files of liferay and insert one line for each new permission with the format:
action.TEST_PERM=Translation
Then reboot the server and voila! When you go to the configuration popup on the portlet instances you can see the new permissions
Sem comentários:
Enviar um comentário