Foren

Setting java property from portal_normal.vm?

brian bohnet, geändert vor 11 Jahren.

Setting java property from portal_normal.vm?

Junior Member Beiträge: 46 Beitrittsdatum: 27.01.10 Neueste Beiträge
We are running Liferay 6.0 EE SP1 on Redhat Linux 5

Being on a 4 node cluster, sometimes logging in as an Administrator, we would like to know to what server we are being routed. Of course, we could go to each server and tail the log files, which means opening up 4 terminal windows and such, which is a nuisance. Or you can check the java properties in the Control Panel ->Server Administration -> Properties; again that's a nuisance.

What I would like to do in the portal_normal.vm, is dynamically set the Liferay java property "web.server.display.node=true" when users login with the Administrator role.

Does anyone know if its possible to dynamically set the property in this manner to have the server node display?

Thanks
thumbnail
David H Nebinger, geändert vor 11 Jahren.

RE: Setting java property from portal_normal.vm?

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
You can add a login post event handler to get the current user, see if they're an administrator, and set the property accordingly.
brian bohnet, geändert vor 11 Jahren.

RE: Setting java property from portal_normal.vm?

Junior Member Beiträge: 46 Beitrittsdatum: 27.01.10 Neueste Beiträge
David H Nebinger:
You can add a login post event handler to get the current user, see if they're an administrator, and set the property accordingly.


Thinking about this a little more, my original idea and the login post event handler would set the property for the portal as whole, so as soon as I login as an Administrator, each subsequent login would see the node display also, which I didn't really want. There could be a risk of users seeing it and complaining or a possibility of affecting the rendered pages.

Is there an easier way to identify the server node than adding a hook, seems like with a few simple lines of velocity markup we could capture what node we are on and keep it isolated to the one user logged in via javascript? ( hence my trying to place this in the portal_normal.vm )
thumbnail
David H Nebinger, geändert vor 11 Jahren.

RE: Setting java property from portal_normal.vm?

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
I wouldn't make it a global property, just a session variable. You can reference the session variable in the velocity template and selectively show it or not.
brian bohnet, geändert vor 11 Jahren.

RE: Setting java property from portal_normal.vm?

Junior Member Beiträge: 46 Beitrittsdatum: 27.01.10 Neueste Beiträge
I'm thinking of just grabbing the System.env HOSTNAME variable and using it your way and displaying to only Administrators, then I'm not dealing with any global settings.

Thanks for your quick and knowledgeable input!
thumbnail
Jay Patel, geändert vor 11 Jahren.

RE: Setting java property from portal_normal.vm?

Regular Member Beiträge: 118 Beitrittsdatum: 24.02.10 Neueste Beiträge
I think you can continue to have property "web.server.display.node=true" set in portal-ext.properties for every user & rather write custom logic in theme's .vm file such that when only admin user has logged in then only node information is shown.

I think this can be done by checking logged-in user's role.

-Jay.
thumbnail
Dhrutika Parekh, geändert vor 11 Jahren.

RE: Setting java property from portal_normal.vm?

Expert Beiträge: 435 Beitrittsdatum: 09.02.09 Neueste Beiträge
Hi Brian,

You can check try this way:
#if ($permissionChecker.isOmniadmin())
$propsUtil("web.server.display.node")
#end

Regards,
Dhrutika