Fórum

Completely hide a portlet if a user is not allowed to use it

Thomas Kellerer, modificado 15 Anos atrás.

Completely hide a portlet if a user is not allowed to use it

Expert Postagens: 490 Data de Entrada: 09/06/08 Postagens Recentes
Hello,

when I set the portlet permissions in order to limit the access to a portlet to certain roles, the portlet itself is still displayed on the page with a message "You do not have the roles required to access this portlet. "

Is there a way to either completely hide the portlet (in case there are other portlets on the page that the user is allowed to see), or at least customize the message that is displayed?

Thanks
Thomas
thumbnail
Sharana Basavaraj BM, modificado 15 Anos atrás.

RE: Completely hide a portlet if a user is not allowed to use it

Regular Member Postagens: 139 Data de Entrada: 10/09/07 Postagens Recentes
Hello Thomas,

You can always customize the message.

Just create Language-ext.properties and update the file with the below key value pair.

Place the created file in %LIFERAY_HOME%/ROOT/WEB-INF/classes/content folder if the folder is not there, then create folder by the said name and place i there.

Restart the server

you-do-not-have-the-roles-required-to-access-this-page={You do not have the roles required to access this page.}
you-do-not-have-the-roles-required-to-access-this-portlet=={You You Can have your own customized message here.}

Cheers emoticon
HTH
Sharan
Thomas Kellerer, modificado 15 Anos atrás.

RE: Completely hide a portlet if a user is not allowed to use it

Expert Postagens: 490 Data de Entrada: 09/06/08 Postagens Recentes
Thanks for the answer (although it isn't quite what I hoped for)

Isn't there an easier way which doesn't require me to use the EXT environment or patch a deployed (third-party) application?

Regards
Thomas


P.S.: Liferay should really try to find a way were we (the "customers") can simply download a war file that can be deployed and upgraded easily. But that's another story.
Thomas Kellerer, modificado 15 Anos atrás.

RE: Completely hide a portlet if a user is not allowed to use it

Expert Postagens: 490 Data de Entrada: 09/06/08 Postagens Recentes
OK, I can answer my own question.

In liferay-portlet.xml one can add a property per portlet that will enable exactly the behaviour I need (completely hide the portlet if the user as no access)


<liferay-portlet-app>
  <portlet>
    <portlet-name>my_portlet</portlet-name>
    <show-portlet-access-denied>false</show-portlet-access-denied>
    <instanceable>false</instanceable>
    <render-weight>1</render-weight>
    <ajaxable>true</ajaxable>
  </portlet>
</liferay-portlet-app>

thumbnail
Tobias Amon, modificado 15 Anos atrás.

RE: Completely hide a portlet if a user is not allowed to use it

Liferay Master Postagens: 546 Data de Entrada: 08/08/07 Postagens Recentes
Maybe this is the way you would normally configure it:

#
# Set the following to true if users are shown that they do not have access
# to a portlet. The portlet init parameter "show-portlet-access-denied" will
# override this setting.
#
	layout.show.portlet.access.denied=false


This is in portal-ext.properties.
thumbnail
ITCSrikanth ITCReddy ITCSanivarapu, modificado 15 Anos atrás.

RE: Completely hide a portlet if a user is not allowed to use it

Regular Member Postagens: 203 Data de Entrada: 15/11/08 Postagens Recentes
Tobias Amon:
Maybe this is the way you would normally configure it:

#
# Set the following to true if users are shown that they do not have access
# to a portlet. The portlet init parameter "show-portlet-access-denied" will
# override this setting.
#
	layout.show.portlet.access.denied=false


This is in portal-ext.properties.


Hi friends,
I am facing a problem like before logging i getting the below pic like not accesiable.
Can any body tell me the solution for this how to disable it completely with out even showing this message.

I've tried all the above mentioned things.
But these things are not working.

Waiting for reply from u guys....
thumbnail
Sharana Basavaraj BM, modificado 15 Anos atrás.

RE: Completely hide a portlet if a user is not allowed to use it

Regular Member Postagens: 139 Data de Entrada: 10/09/07 Postagens Recentes
Hey Thomas,

Thats really Coool. emoticon

Thanks a lot.
thumbnail
ITCSrikanth ITCReddy ITCSanivarapu, modificado 15 Anos atrás.

RE: Completely hide a portlet if a user is not allowed to use it

Regular Member Postagens: 203 Data de Entrada: 15/11/08 Postagens Recentes
Sharana Basavaraj BM:
Hey Thomas,

Thats really Coool. emoticon

Thanks a lot.


Hi this thing is not working for liferay5.1.2?
Can u please suggest the correct way?

Thanks & Regards,
Srikanth Reddy.S