掲示板

Setting java property from portal_normal.vm?

11年前 に brian bohnet によって更新されました。

Setting java property from portal_normal.vm?

Junior Member 投稿: 46 参加年月日: 10/01/27 最新の投稿
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
11年前 に David H Nebinger によって更新されました。

RE: Setting java property from portal_normal.vm?

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
You can add a login post event handler to get the current user, see if they're an administrator, and set the property accordingly.
11年前 に brian bohnet によって更新されました。

RE: Setting java property from portal_normal.vm?

Junior Member 投稿: 46 参加年月日: 10/01/27 最新の投稿
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
11年前 に David H Nebinger によって更新されました。

RE: Setting java property from portal_normal.vm?

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
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.
11年前 に brian bohnet によって更新されました。

RE: Setting java property from portal_normal.vm?

Junior Member 投稿: 46 参加年月日: 10/01/27 最新の投稿
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
11年前 に Jay Patel によって更新されました。

RE: Setting java property from portal_normal.vm?

Regular Member 投稿: 118 参加年月日: 10/02/24 最新の投稿
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
11年前 に Dhrutika Parekh によって更新されました。

RE: Setting java property from portal_normal.vm?

Expert 投稿: 435 参加年月日: 09/02/09 最新の投稿
Hi Brian,

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

Regards,
Dhrutika